Question
Payroll Design a PayRoll class that is an abstract data type for payroll. It has data members for an employees hourly pay rate, number of
Payroll
Design a PayRoll class that is an abstract data type for payroll. It has data members for an employees hourly pay rate, number of hours worked, and total pay for the week.
Your class must include the following member functions:
a constructor to set the hours and pay rate as arguments,
a default constructor to set data members to 0,
member functions to set each of the member variables to values given as an argument(s) to the function,
member functions to retrieve the data from each of the member variables,
an input function that reads the values of number of hours and hourly pay rate,
an output function that outputs the value of all data members for an employee,
void function to calculate the total pay for a week.
The input and output functions will each have one formal parameter for the stream.
Write a program with an array of seven PayRoll objects. The program should ask the user for the number of hours each employee has worked and will then display the amount of gross pay each has earned.
Input Validation: Do not accept values greater than 60 for the number of hours
worked.
Sample Output:
Enter the hours worked and pay rate for 7 employees:
Employee #1 pay rate: 15
Employee #1 hours worked: 40
Employee #2 pay rate: 20
Employee #2 hours worked: 35
Employee #3 pay rate: 18
Employee #3 hours worked: 40
Employee #4 pay rate: 22
Employee #4 hours worked: 38
Employee #5 pay rate: 15
Employee #5 hours worked: 40
Employee #6 pay rate: 20
Employee #6 hours worked: 32
Employee #7 pay rate: 22
Employee #7 hours worked: 40
Total pay:
Employee #1: 600.00
Employee #2: 700.00
Employee #3: 720.00
Employee #4: 836.00
Employee #5: 600.00
Employee #6: 640.00
Employee #7: 880.00
Press any key to continue . . .
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