Answered step by step
Verified Expert Solution
Link Copied!

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 i.e FullTimeEmployee and PartTimeEmployee.
Full-time employees are paid R500 per hour, while part-time employees are paid R750 per hour. For full-time employees, any hours worked over 40 should be considered overtime and paid at 2 times the hourly rate. For part-time employees, any hours worked over 20 should be considered overtime and paid at 1.5 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
1. Ask the user to input whether the employee is part-time or full-time.
2. Ask the user to input the number of hours worked by the employee.
3. Calculate the employee's total pay based on the input (part-time or full-time) 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions