Wyo Java Ch11Proj2

Do Exercise P11.4 on p. 471. Name the test class Ch11Proj2 and use it to test your Person, Student, and Instructor classes. You must override the equals and toString methods in the Person, Student, and Instructor classes. All three classes should realize the Comparable interface as well. You must override the compareTo method in each class in an appropriate, logical way. In the test class, instantiate two or more of each kind of object and allow the user to input values (JOptionPane or BufferedReader) into each property of each object. Test each pair of objects for equality and display the object with toString as well as whether they are equal or not. All output must be made from the test class using the System.out.println method. Use super in constructors where applicable.

Your program must follow the class Coding Standards. Save all of the files associated with this assignment to a folder named Ch11Proj2 in the appropriate network folder.

Preconditions:

    • None

Sample runtime output:

Input person #1 name: John Doe
Input person #1 year of birth: 1990
Input person #2 name: Jane Doe
Input person #2 year of birth: 1989
person #1 name - John Doe - year of birth - 1990
person #2 name - Jane Doe - year of birth - 1989
The two Person objects are not equal
person #1 is less than person #2
Input student #1 name: Bill Smith
Input student #1 year of birth: 1985
Input student #1 major: computer science
Input student #2 name: Bill Smith
Input student #2 year of birth: 1985
Input student #2 major: computer science
student #1 name - Bill Smith - year of birth - 1985 - major - computer science
student #2 name - Bill Smith - year of birth - 1985 - major - computer science
The two Student objects are equal
student #1 is equal to student #2
Input instructor #1 name: Albert Einstein
Input instructor #1 year of birth: 1900
Input instructor #1 salary: 15000
Input instructor #2 name: Stephen Hawking
Input instructor #2 year of birth: 1922
Input instructor #2 salary: 25000
instructor #1 name - Albert Einstein - year of birth - 1900 - salary - 15000
instructor #2 name - Stephen Hawking- year of birth - 1922 - salary - 25000
The two Instructor objects are not equal
instructor #1 is greater than instructor #2



You must hand in the following on separate pages stapled in this specified order:

    1. The source code for the Ch11Proj2 class.
    2. The source code for the Person class.
    3. The source code for the Instructor class.
    4. The source code for the Student class.