Question: 1. Create a package called hrInterface. Define an interface Payable with a calcPayroll method in the package. 2. Create another package called employee. Define three
1. Create a package called hrInterface. Define an interface Payable with a calcPayroll method in the package.
2. Create another package called employee. Define three small classes in the package: full-time employee, part-time employee and intern. These three kinds of employees are able to be paid, whose payroll can be calculated by the formulas:
Full-time employee: base salary + bonus
Part-time employee: working hours * payment per hour
Intern: stipend
(The full-time employee should have two data members to store base salary and bonus; the part-time employee should have two data members to store working hours and payment per hour; the intern should at least one data member to store stipend.)
3. Create the third package called test. Define a driver class (with main method) and use polymorphism to test your program.
4. Use multiple inheritance to define another class Full-time permanent employee, besides the payroll, who also has the benefit to accumulate paid time-off. A full-time permanent employee is able to accumulate 50 hours paid time-off for each year he/she has served. Then create a full-time permanent employee instance in your driver class and print out its payroll and accumulated paid time-off hours.
Hints: Create another interface with calcPaidTimeOff()method. Make the class Full-time permanent employee implements the new defined interface and payable interface. The class should have at least three data members to store the base salary, bonus, and the number of years served.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
