Question
Write a C++ program that reads employee data from a file (hourly wage, id number, and name) into parallel arrays. Update the hourly wage then
Write a C++ program that reads employee data from a file (hourly wage, id number, and name) into parallel arrays. Update the hourly wage then output a formatted report.
o The input file is named wages.in. Each line of this file contains an hourly wage, a four digit id number, and a name, in that order. o The output file must be named wages.rpt. o For each function make sure you are passing properly the parameters by value or by reference as is appropriate. o You must define and use global constants for: the maximum number of employee records to be read and minimum wage o You must use and define the following three functions; you may define more functions if you find it useful to do so. loadArraysFromFile Parameters: an ifstream connected to the input file, a double array for the hourly wages, an int array for the id numbers, and a string array for the employees names. Return: int the number of employee records read Read the employee records into the arrays. newHourlyWage Parameters: an int id number and a double for the wage (these are NOT arrays) Return: double the new hourly wage Determine the new hourly wage using the following method, in the given order. If the wage is less than minimum wage change it to minimum wage. If the id number starts with a 1 or 2 the employee gets a 2% raise If the id number starts with a 3 or 4 the employee gets a 2% raise then an extra 5/hour. If the id number starts with a 5 or 6 the employee gets a 4% raise then an extra 5/hour. If the id number starts with a 7 the employee gets a 5% raise then an extra 5/hour. If the id number starts with a 8 the employee gets a 5% raise then an extra 10/hour. If the id number starts with a 9 the employee gets a raise of 50/hour. The hourly wage must be ROUNDED to 2 decimal places before it is returned. writeReport Parameters: an ofstream connected to the output, an int array for the id numbers, a string array for the employees names, a double array for the hourly wages, and an int for the number of records read. Return: none Print the report to the output file formatted as seen in the picture below.
Here is the content of the file:
15.85 2655 Qyzen Fess
20.17 3111 Tharan Cedrax
25.51 4463 Zenith
15.51 2413 Lt. Felix Iresso
30.85 5485 Nadia Grell
20.17 3511 T7-01
15.17 2421 Kira Carsen
10.68 1594 Doc
15.68 2964 Sergeant Rusk
26.02 4336 Lord Scourge
21.36 3168 Corso Riggs
10.19 4877 Bowdaar
15.51 2373 Risha
15.17 2471 Akaavi Spar
25.34 4252 Guss Tuno
20.34 3672 Aric Jorgan
10.68 1394 Elara Dorne
25.34 4352 M1-4X
20.85 3975 Tanno Vik
21.02 3756 Yu'un
20.34 3052 C2-N2
16.02 2066 Treek
20.17 3301 HK-51
21.53 3899 Lana Beniko
25 4170 Theron Shan
10.51 1473 Koth Vortena
25.85 4125 Senya Tirall
15.17 2661 Nico Okarr
20.51 3583 Shae Visla
11.00 1708 Blizz
26.36 4098 Dr. Loken
25.51 4743 Kaliyo
20 3730 Talos Drellik
20.17 3131 Pierce
15.34 2982 Vette
20.85 3245 Torian Cadera
20.85 3975 Tanno Vik
21.02 3756 Yu'un
20.34 3052 C2-N2
16.02 2066 Treek
20.17 3301 HK-51
21.53 3899 Lana Beniko
25 4170 Theron Shan
10.51 1473 Koth Vortena
25.85 4125 Senya Tirall
15.17 2661 Nico Okarr
20.51 3583 Shae Visla
11.00 1708 Blizz
26.36 4098 Dr. Loken
25.51 4743 Kaliyo
20 3730 Talos Drellik
20.17 3131 Pierce
15.34 2982 Vette
20.85 3245 Torian Cadera
20.85 3248 Xalek
20.17 3302 HK-55
Here is how the report should look like:
WAGE REPORT ID NUMBER NAME 2655 oyzen Fess 3111 Tha ran Cedrax 4463 Zenith Lt. Felix Iresso 2413 5485 Nadia Grell 3511 T7-01 2421 Kira Carsen 1594 Doc 2964 Sergeant Rusk 4336 Lord Scourge 3168 Corso Riggs 4877 Bowdaar 2373 Risha 2471 Akaavi Spar 4252 Guss Tuno 3672 Aric Jorgan 1394 Elara Dorne 4352 M1-4X 3975 Tanno Vik 3756 Yu un 3052 C2-N2 2066 Treek 3301 HK-51 3899 Lana Beniko 4170 Theron Shan 1473 Koth Vortena ll 4125 Senya Tira 2661 Nico Okarr 3583 Shae Visla 1708 Blizz Loken 4098 Dr Kaliyo 4743 3730 Talos ik 3131 Pierce 2982 Vette 3245 Tor Cadera 3248 Xalek 3302 HK-55 Report Ends HOURLY WAGE 16.17 20.62 26.07 15.82 32.13 20.62 15.47 11.42 15.99 26.59 21.84 11.47 15.82 15.47 25.90 20.80 11.42 25.90 21.32 21.49 20.80 16.34 20.62 22.01 25.55 11.42 26.42 15.47 20.97 11.42 26.94 26.07 20.45 20.62 15.65 21.32 21.32 20.62Step 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