question archive Write a program to control the Payroll System of an organization (Application of Polymorphism)
Subject:Computer SciencePrice: Bought3
Write a program to control the Payroll System of an organization (Application of Polymorphism).Create an employee class hierarchy (inheritance) in order to solve the following problem: Consider, a company pays its employees in every weekly. There are four different groups of employees.
(1) Permanent Employee : Receives fixed weekly payments regardless of the number of hours they work at the workplace.
(2)Casual Employees: Employees are paid by the amount of hours they work. They also receive overtime pay for working over 40 hours. i.e. if an hourly employee works 50 hours in a week, the first 40 hours would be paid by regular payment, remaining (50-40) 10 hours will be overtime payment that is 1.5 times of the regular payment rate.
(3) CommissionEmployee: Commission employees are paid by a percentage of their total sales.
(4) BasePlusCommissionEmployee: This group receives a base salary, additionally they also receives a percentage of their total sales.
Assume, further that, the management have decided to increase BasePlusCommissionEmployee's basic pay by 30% of their base salary.
Output of the Code look like this:
Employees processed individually:
Permanent Employee: Tom
Social security number: 111-22-3333
Weekly salary $800.00
Earned $800.00
Casual Employees: Jerry
Social security number: 111-22-4444
Hourly wage $16.75; Hours worked 45
Earned $795.63
Commission employee: Richard
Social security number: 444-44-4444
Gross sales $10000.00; Commission rate $0.06
Earned $600.00
Base-salaried-commission employee: Drake
Social security number: 777-77-7777
Gross sales $5000.00; Commission rate $0.04; Base salary $300.00
Earned $500.00
Utilise polymorphism to iterate across different employees:
Permanent Employee: Tom
Social security number: 111-22-3333
Weekly salary $800.00
Earned $800.00
Casual Employees: Jerry
Social security number: 111-22-4444
Hourly wage $16.75; Hours worked 45
Earned $795.63
Commission employee: Richard
Social security number: 444-44-4444
Gross sales $10000.00; Commission rate $0.06
Earned $600.00
New base-salary with 30% increase is: $390
Base-salaried-commission employee: Drake
Social security number: 777-77-7777
Gross sales $5000.00; Commission rate $0.04; Base salary $390.00
Earned $590.00
Employee 1 is Permanent Employee
Employee 2 is
Casual EmployeesEmployee 3 is CommissionEmployee
Employee 4 is BasePlusCommissionEmployee