Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ASSIGNMENT 2 Assignment 2 tests your knowledge of Decisions Structures ( Chapter 4 ) , repetition structures / Loops ( Chapter 5 ) and Classes
ASSIGNMENT Assignment tests your knowledge of Decisions Structures Chapter repetition structuresLoops Chapter and Classes and Objects in Java Chapter and should be solved using concepts learned in class so far Chapters to and requirements bellow. Design a class called YourNameMonth, replace YourName with your actual name with the exact fields and methods : FieldMethod Description Number An integral field that holds the number of the month which is a value between and where Number Corresponding Name January February March April May June July August September October November December YourNameMonth A noargument constructor that sets the Number field to YourNameMonth A constructor with one integral parameter representing the number of the month etc. and sets the Number field to that value. If a value less than or larger that is passed, the constructor should set Number to YourNameMonth A constructor with one string parameter representing the name of the month JanuaryFebruary etc. that sets the Number field to the corresponding number. If the value is invalid less than or larger than should set Number to You should NOT add another field for the name of the month. YourNameMonth A copy constructor that copies the Number field value from another month object. getNumber An integral method that returns the Number field value setNumber A void method with an integral parameter that sets the Number field to that integral number getName A String method that returns the name of the month corresponding to the Number field value toString A string method that returns a string with this format: Month is NUMBER where NUMBER is the field Number equals A Boolean method that accepts a YourNameMonth object Month as an argument and returns true if the data from that object its Number is the same as the Number field of Month or false otherwise. compareTo An integral method that accepts a Month object Monthas an argument and returns if Number value from the class is the same as the number from the Month object, if it is smaller, and if it is larger. Design a driver class called YourNameAssignmentreplace YourName with your actual name in the same project as the YourNameMonth. You will need to add the class Month to the project and add your code to the project class main method. The program code should: Create three objects: Month using the first noarg constructor, Month using the second constructor with as an argument, Month using the third constructor with October as an argument, and Month using the fourthcopy constructor from Month Use the getNumber to get the month number from objects Month Month Month and Month and output the them. Use the getName to get the month name from objects Month Month Month and Month and output them. Use the setNumber to set the Month object value to Use the toString to get the month string from objects Month Month Month and Month and output them. Use the equals method of Month to compare its value with Month value and output the result. Use the compareTo method of Month to compare its value with Month value and output the result. Implement the classes in NetBeans IDE and JAVA: Create a JAVA project called YourNameAssignmentsame name as the driver class add the class YourNameMonth to the YourNameAssignment project and add your code to the YourNameMonth class and YourNameAssignmen projectdriver class main method. Your program should be userfriendly and be welldocumentedcommented have comments for every line of code Create the screenshot document for your code and output: Create a Microsoft Word document from the YourNameAssignmentN.docx template and call it YourNameAssignmentdocx replace YourName with your actual name with your screenshots of the NetBeans editor window showing the complete JAVA source code for both YourNameAssignmentClass and YourNamePet Driver Class classes and the complete output. If the entire class JAVA source code or the output does not fit in one screenshot or the screenshots cannot be easily read, create multiple screenshots and add multiple screenshots to the screenshot document. If your output is longer than a line and does not fit on one screen, Wrap Text in your output panel. Submit your work: Submit YourNameAssignmentdocx on eCampus under the Assignment Do not submit other typesformats of files eg no CLASS, PDF JAVA, ZIP, RAR, etc. Please take time after submitting to review the file and check it is correct and resubmit it if there are any errors. You are going to lose points for not documenting your code commenting each line of code for not naming the programs and files as requested, not submitting the correct files, cheating, hardcoding the results, and using concepts we did not learn in class
ASSIGNMENT
Assignment tests your knowledge of Decisions Structures Chapter repetition structuresLoops Chapter and Classes and
Objects in Java Chapter and should be solved using concepts learned in class so far Chapters to and requirements bellow.
Design a class called YourNameMonth, replace YourName with your actual name with the exact fields and methods
:
FieldMethod Description
Number An integral field that holds the number of the month which is a value between and where
Number
Corresponding
Name
January February March April May June July August September October November December
YourNameMonth A noargument constructor that sets the Number field to
YourNameMonth A constructor with one integral parameter representing the number of the month etc. and sets the Number
field to that value. If a value less than or larger that is passed, the constructor should set Number to
YourNameMonth A constructor with one string parameter representing the name of the month JanuaryFebruary etc. that sets
the Number field to the corresponding number. If the value is invalid less than or larger than should set
Number to You should NOT add another field for the name of the month.
YourNameMonth A copy constructor that copies the Number field value from another month object.
getNumber An integral method that returns the Number field value
setNumber A void method with an integral parameter that sets the Number field to that integral number
getName A String method that returns the name of the month corresponding to the Number field value
toString A string method that returns a string with this format: Month is NUMBER where NUMBER is the field Number
equals A Boolean method that accepts a YourNameMonth object Month as an argument and returns true if the data from
that object its Number is the same as the Number field of Month or false otherwise.
compareTo An integral method that accepts a Month object Monthas an argument and returns if Number value from the class
is the same as the number from the Month object, if it is smaller, and if it is larger.
Design a driver class called YourNameAssignmentreplace YourName with your actual name in the same project as the
YourNameMonth. You will need to add the class Month to the project and add your code to the project class main method. The
program code should:
Create three objects: Month using the first noarg constructor, Month using the second constructor with as an argument,
Month using the third constructor with October as an argument, and Month using the fourthcopy constructor from Month
Use the getNumber to get the month number from objects Month Month Month and Month and output the them.
Use the getName to get the month name from objects Month Month Month and Month and output them.
Use the setNumber to set the Month object value to
Use the toString to get the month string from objects Month Month Month and Month and output them.
Use the equals method of Month to compare its value with Month value and output the result.
Use the compareTo method of Month to compare its value with Month value and output the result.
Implement the classes in NetBeans IDE and JAVA: Create a JAVA project called YourNameAssignmentsame name as the driver
class add the class YourNameMonth to the YourNameAssignment project and add your code to the YourNameMonth class and
YourNameAssignmen projectdriver class main method. Your program should be userfriendly and be welldocumentedcommented have comments for every line of code
Create the screenshot document for your code and output: Create a Microsoft Word document from the YourNameAssignmentN.docx template and call it YourNameAssignmentdocx replace YourName with your actual name with your
screenshots of the NetBeans editor window showing the complete JAVA source code for both YourNameAssignmentClass and
YourNamePet Driver Class classes and the complete output. If the entire class JAVA source code or the output does not fit in one
screenshot or the screenshots cannot be easily read, create multiple screenshots and add multiple screenshots to the screenshot
document. If your output is longer than a line and does not fit on one screen, Wrap Text in your output panel.
Submit your work: Submit YourNameAssignmentdocx on eCampus under the Assignment Do not submit other typesformats
of files eg no CLASS, PDF JAVA, ZIP, RAR, etc. Please take time after submitting to review the file and check it is correct and resubmit
it if there are any errors.
You are going to lose points for not documenting your code commenting each line of code for not naming the programs and files as requested,
not submitting the correct files, cheating, hardcoding the results, and using concepts we did not learn in class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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