Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Develop a class Employee to manage employee payroll. Create a class called Employee with members name, age, hoursWorked, and hourlyRate. The program should include two
Develop a class Employee to manage employee payroll. Create a class called Employee with members name, age, hoursWorked, and hourlyRate. The program should include two subclasses of the Employee type ie FullTimeEmployee and PartTimeEmployee.
Fulltime employees are paid R per hour, while parttime employees are paid R per hour. For fulltime employees, any hours worked over should be considered overtime and paid at times the hourly rate. For parttime employees, any hours worked over should be considered overtime and paid at times the hourly rate.
Use polymorphism to define methods to calculate the employee's total pay in each subclass, including overtime if applicable and display the results.
Implement the following steps
Ask the user to input whether the employee is parttime or fulltime.
Ask the user to input the number of hours worked by the employee.
Calculate the employee's total pay based on the input parttime or fulltime and the number of hours worked, including overtime pay if applicable.
Display the employee's name, age, hourly rate, total hours worked, regular pay, overtime pay if applicable and total pay.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started