Question: Write the program in C++ only Please read the question carefully and answer correctly Parallel arrays Write a program to calculate and store employee pay
Write the program in C++ only
Please read the question carefully and answer correctly
Parallel arrays
Write a program to calculate and store employee pay and create a payroll report. Declare a constant for the number of employees:
const int empsize = 5;
Create two parallel arrays of this size to store employee names and gross pay. The user is prompted to enter names, hours, and rate for each employee. You can store hours and rate in an array if you like, but note that it is not necessary. Just calculate and store the pay in the array. Create the following functions to use in doing this program:
getData receives the two arrays (names and pay) and the size of the array (number of
employees. There is no return. Prompt for the data for each employee (name,
rate, hours). Calculate the pay. Store the name and pay in the arrays.
calcPay receives two double values that represent hours and rate. It calculates and
returns the pay. Make sure to handle overtime hours correctly. Hours over 40
are paid at 1.5 times hourly rate. Note this function does NOT use arrays.
printPayroll receives the names and pay array and the size of the array. There is not return.
Prints the report as shown in sample output below. Also calculate and display
the total payroll.
Sample Output (Test case 1: use const int empsize = 3. you make up the names. YOU will need to make sure your answers are correct)
Employee name? (you make up name)
Hours worked? 50
Hourly rate? 22.50
Employee name? (you make up name)
Hours worked? 35
Hourly rate? 20
Employee name? (you make up name)
Hours worked? 40
Hourly rate? 32.75
PAYROLL REPORT
Employee Pay
(name) xxxx.xx
(name) xxxx.xx
(name) xxxx.xx
Total payroll $xxxx.xx
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
