Polymorphism


Polymorphism

Monster
MuppetMonster
VampireBat
Test Harness


Classwork


Part A

Create a class Employee.  Employees have a name.   Also give Employee a method paycheck() which returns a double.  For basic employees, paycheck is always 0 (they just get health insurance).  Give the class a parameterized constructor that takes the name;

Add a method reportDeposit.  This method prints a report for the employee with the original amount of the paycheck, the amount taken out for taxes (we will do a flat 17%), and the final amount (for basic employees this will just be a lot of 0's but make sure to do the math based on what paycheck returns). 

Salaried employees are employed either for 10 or 12 months of the year for some salary. Using inheritance, create a class for this type of employee (more will be added in part B) with appropriate instance vars

For salaried employees, their paycheck is their salary, divided up into two pays a month for however many months they are employed. Don't override reportDeposit for this class.  Give a parameterized constructor for name and salary that chains back to the parameterized superclass constructor.

In a main, create an array of employees, and set it up with some of each kind, some with different values.  (hint: you've got parameterized constructors...)  Loop through the list and call reportDeposit for each employee, also find the employee with the highest paycheck.

Part B 

Hourly employees have an hourly wage, and a number of hours they are scheduled to work per week, (think about instance vars for these).  For them, one paycheck is based on two weeks of work (they are guaranteed to have the same hours for both weeks).  They are paid an extra 5% of their hourly rate for each hour over 40 hours per week they are scheduled.

Adjunct employees may teach up to 18 credits, and are paid $827 per credit, with the total spread across 2 paychecks a month for 4 months. Give them appropriate instance vars and override paycheck.

 Add two hourly and two  adjunct employees to your array in main. You shouldn't have to change anything else in main.