See this link for Assignment
Policies, Submission Instructions, and Grading Guidelines.
1.
Write a Java
application that does the following:
2. IMPORTANT NOTE: Create a 2nd
class (class definition) in the same file as your LastNameFirstNameX
class (client) with 2 data fields &
6 methods. Note that these are non-static variables & methods. The 2nd
class should NOT have the keyword “public” in front of it.
3. The 2nd class models Months. The 2nd class is the class definition for a Month.
4. The Month class definition should contain the following 2 data fields (attributes): name of the month, & year of the month.
5. For example, this month is “October 2007”.
6. The Month class definition should contain the following 6 methods (behaviors): constructor, toString(), 2 accessor methods, and 2 mutator methods.
7. The constructor should initialize (assign a beginning value) to the 2 data fields.
8. The toString() method should return a string of the 2 data fields, so that they can be appropriately displayed.
9. The 1st class is the client. It has the same name as LastNameFirstNameX. It has the main() method.
10. In the main() method of the 1st class, instantiate (create) 3 Month objects. Use the constructor to do this.
11. In the main() method of the 1st class, use the toString() method to display the 3 Month objects. Use either System.out.println() or JOptionPane.showMessageDialog().
12. In the main() method of the 1st class, use the accessor methods to get the values of the 2 data fields from the first Month object.
13. In the main() method of the 1st class, use the mutator methods to set the values of the 2 data fields of the 2nd and 3rd object to the 2 data fields of the 1st object.
14. In the main() method of the 1st class, re-display all 3 objects.
15. For example, if my first object is “October 2007”, my second object is “April 1984”, and my third object is “May 2010”, then my program will get the values “October” and 2007 from the 1st object, and set the data fields of the 2nd and 3rd objects, so that all 3 objects have the values “October” and 2007 for their data fields.
16. In other words, Month objects “October 2007”, “April 1984”, and “May 2010” become “October 2007”, “October 2007”, “October 2007” using the accessor (get) and mutator (set) methods.
17. IMPORTANT NOTE: Make
sure that your program follows the ICS 111 Java Coding Standard. The comments
above each method should be written in the appropriate format.
18. For
this assignment, since there is no input (only output), you do not need to use
try-catch blocks.
© 2007 William Albritton