Question: Can you help me with this java code? Inheritance and Polymorphism The objective of this programming assignment is to reinforce the use of inheritance and

Can you help me with this java code?  Can you help me with this java code? Inheritance and Polymorphism
The objective of this programming assignment is to reinforce the use of
inheritance and to see how polymorphism works with inheritance in Java The
assignment involves writing three classes, plus a test class. The base class

Inheritance and Polymorphism The objective of this programming assignment is to reinforce the use of inheritance and to see how polymorphism works with inheritance in Java The assignment involves writing three classes, plus a test class. The base class is an employee class which contains a couple of attributes common to all employees and a fundamental method to calculate pay. The two derived classes are a commissioned employee that adds payment of a sales commission as part of the pay calculation, and a union employee which adds overtime payment and union dues as part of the pay calculation. The test program will be structured to include a function which accepts a base class reference and demonstrates polymorphic behavior. NOTE: The properties of all three classes MUST BE private!!! Also, the only class that can do any I/O is the test class! Make sure all 3 employee classes are properly commented with Javadoc comments. The details of the three classes to be implemented are as follows 1. An Employee contains a name and an hourly pay rate. An explicit value constructor must be provided to set both values when an Employee object is created. There must be mutator methods for both properties. There must be a weekly pay method that takes an integer parameter for the number of hours worked and returns the amount of pay for the week. If the number of hours worked is less than 40 hours, the pay is the number of hours times the rate. If the number of hours worked is 40 or more, the pay is 40 times the rate. There must also be a toString method which returns the both properties in a string, each property on a separate line. 2. The Union Employee inherits from the Employee class. A Union Employee contains a dues variable which holds the amount of dues a Union Employee has withheld from their paycheck each week. An explicit value constructor must be provided to set both values from the base class along with the dues value. There must be a mutator method provided to set the dues property. The base class weekly pay method must be overridden because a Union Employee gets 1.5 times the pay rate for any hours over 40 per week. This method must use the base class weekly pay method to calculate pay for the first 40 hours and then add the overtime amount. In addition this method reduces the weekly pay amount by the amount of dues withheld. Finally, add a toString method which overrides the base

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!