Do Exercise P11.6 on p. 472. Name the test class Ch11Proj3 and use it to test your Worker, HourlyWorker, and SalariedWorker classes. The salary rate is in dollars per hour (e.g. 40).
- Each class must have a default constructor and another constructor that initializes each of its fields to a user-specified value. You must use the keyword super where appropriate.
- The Worker class must include a modifier and an accessor for each of its fields.
- The method computePay must be abstract in the Worker class and it must be overrided in each of the child classes. (The parameter to computePay does not get used in the method computePay within SalariedWorker.)
- (AP students only) You must also include an equals method in the Worker class. Test this method in some manner in the test class. See the textbook for the conventional way to override the equals method which is inherited by all classes from the Object class.
- The test class does not have to accept inputted data. You can use constructors or modifier methods to assign values to the fields of the object variables. The test class must execute in a way that clearly tests each of the overrided computePay methods.
Your program must follow the class Coding Standards. Save all of the files associated with this assignment to a folder named Ch11Proj3 in the appropriate network folder.
Preconditions:
You must hand in the following on separate pages stapled in this specified order:
- The source code for the Ch11Proj3 class
- The source code for the Worker class.
- The source code for the HourlyWorker class.
- The source code for the SalariedWorker class.