Question
C++ Code) 2. Design, develop, and test class Payroll with private member variables for an employees hourly pay rate and number of hours worked. Member
C++ Code) 2. Design, develop, and test class Payroll with private member variables for an employees hourly pay rate and number of hours worked. Member functions include ctor, set__() functions for hours and payRate, and accessor [get__()] functions to return the hours and payRate, and an accessor that computes and returns the gross pay. Test with a driver program that uses an array of employees with a minimum number of 7 array components, prompts for the pay rate and number of hours worked by each employee, and outputs the weekly gross pay for each employee. Sample output is shown below. Data validation: the setHours() member function should not accept an input value less than zero or greater than 60. /* Sample output: Enter hours worked and pay rate for 7 employees: Employee #1 pay rate: $18.64 Employee #1 hours worked: 66 Hours must be between 0 and 60! : 55 Employee #2 pay rate: $20.0 Employee #2 hours worked: -44 Hours must be between 0 and 60! : 44 Employee #3 pay rate: $19.82 Employee #3 hours worked: 40 Employee #4 pay rate: $35.75 Employee #4 hours worked: 43.6 Employee #5 pay rate: $29.92 Employee #5 hours worked: 40.8 Employee #6 pay rate: $18.98 Employee #6 hours worked: 45 Employee #7 pay rate: $21.16 Employee #7 hours worked: 44 Total pay: Employee #1: $1025.20 Employee #2: $ 880.00 Employee #3: $ 792.80 Employee #4: $1558.70 Employee #5: $1220.74 Employee #6: $ 854.10 Employee #7: $ 931.04 */
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