Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this needs to be written in java. Create a New Class... named Month Use Javadoc documentation standards (comments & tags) and good programming style as
this needs to be written in java.
Create a "New Class..." named Month Use Javadoc documentation standards (comments & tags) and good programming style as discussed in class (Appendix I & J) Declare an integer field named monthNumber Declare a String field named monthName Add a constructor that takes one integer input parameter and include: if statement to check input parameter equals 0 or greater than 12) print "ERROR: Month # must be between 1 and 12" (where the # sign is the actual value of the input parameter) else if (the value of the input is less than 0) print "ERROR: Month # must be positive" (where the # sign is the actual value of the input parameter) else // the value of the input is valid print "Month # is VALID" (where the #sign is the actual value of the input parameter) assignment statement to initialize the field monthNumber to the input parameter (regardless if valid or not) Internal call to method named setMonthName Internal call to method named print Month Add an accessor method named getMonth Number to return the value of the field monthNumber Add another accessor method named getMonthName to return the value of the field monthName Add a method named setMonthName to EXACTLY include: switch statement on the field monthNumber . where case matches 1 would set monthName to January where case matches 2 would set monthName to February where case 3-12 would also set monthName appropriately . and the default would set monthName to Invalid Month Add a method named print Month to: print formatted String Month # is NNNN (where the #sign is value of field monthNumber and NNNN is the value of field monthName)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started