Due Date:
Thursday, January 25
File(s) to be submitted:
Person.java, Student.java, Undergrad.java, Graduate.java, Employee.java, Faculty.java, Staff.java, Payable.java
Sample Output:
SampleOutput.html
Starter Files:
Summary
For this assignment you are to extend the Person-Student-Undergraduate inheritance hierarchy discussed in class. In particular, you are to create the classes and interface shown in this diagram:
The four classes on the left of the diagram (Person, Student, Undergraduate, and Graduate) have already been provided.
Give each of Student, Undergraduate and Graduate a writeOutput method (as described below).
Also, revise Person so that it sorts naturally by name, and give Employee a Comparator that allows Employees to be sorted by income, from highest to lowest.
I have provided a sample program you can use to test your code. Parts of the program are commented out. You will need to activate those parts of the program as you complete each part of the assignment.
Here are the descriptions of each class.
This class is abstract. It implements (abstractly) the Payable interface (described below).
I didn't discuss abstract classes in lecture, but they are somewhere between classes and interfaces. Some of their methods have definitions, and some do not.
- The methods that do not have a definition must have the word abstract added to their header, just before the return type. For example:
public abstract void noDefinition(String arg);- The class itself must also have the word abstract in its header, just before the word class:
public abstract class NotAllDefined
For each class you are to implement the following methods (which are the same methods you find in the classes already implemented):
The Faculty and Staff classes will, of course, also have to implement the methods given in the Payable interface.
The Employee class should define appropriate constants for the number of weeks in a year, the number of hours in a week, and the minimum wage (which I hear is $11.55 per hour). The Faculty and Staff classes should use them.
The classes you create will all be very similar to the Student and Undergraduate classes supplied to you.
The Faculty and Staff classes do not need to say that they implement Payable, even tho they do. Because they are sub-classes of Employee, the computer will know.
Test your inheritance hierarchy using the OurSchool program I have provided for you. You may want to examine it before you begin the assignment -- it has some method names that you must use.