Assignment 5
Assignment 5
In this assignment, you need to define four classes, Employee, Hourly Employee, Salaried Employee, and
Manager. The relationship of the classes is shown below.
The Employee class should have an instance variable _name; you need to create the getter method and
setter method for the variable; and there is a pay method which has one parameter for hoursWorked,
the method will return 0 (as salary paid) for an employee.
The Hourly Employee class should inherit the Employee class and have an instance variable _hourlyRate;
the pay method will be overridden, the returned value will be calculated (hoursWorked *_hourlyRate).
The Salaried Employee class should inherit the Employee class and have an instance variable
_annualSalary, you need to create the getter method and setter method for the variable; the pay
method will be overridden, the returned value will be calculated ( _annualSalary /12)
The Manager class should inherit the Salaried Employee class and have an instance variable _bonus, you
need to create the getter method and setter method for the variable; the pay method will be
overridden, the returned value will be calculated ( super().pay(hoursWorked) + self._bonus)
Create a driver/tester file to test the objects of each class defined. (Hint: create object of each class and
use the pay method, pay attention that the calculation will be different for different object, but they are
using the same pay method.