Below is the instructions of my C++ Lab. The program must build in Microsoft Visual C++. Please use headers so the program will compile
A sample data file is provided for your testing purposes as follows:
4
101 41 8.11 Y 49
722 32 7.22 N 40
1273 23 5.43 Y 39
2584 14 6.74 N 45
The first integer in the file corresponds to the number of data rows in the file, the data rows represent employee information for a small company and is interpreted as follows:
Employee No.
|
Department
|
Pay Rate
|
Exempt
|
Hours Worked
|
101
|
41
|
8.11
|
Y
|
49
|
722
|
32
|
7.22
|
N
|
40
|
1273
|
23
|
5.43
|
Y
|
39
|
2584
|
14
|
6.74
|
N
|
45
|
Write a C++ program to read the employee file as structs in an array of employee data.
Prompt for the name of the input file.
i.e.
struct empData
{
int empNo,
departNum,
double payRate,
hrsWrkd;
char exempt;
};
Read the first integer in the file, then create a dynamic array of the correct size to hold the employee information.
Create a payroll output file with headers similar to that shown in the following list. Prompt for the name of the output file. The output file is to contain the following data:
a. Employee number (left justified)
b. Department
c. Pay Rate
d. Exempt
e. Hours Worked
f. Base pay (pay rate * hours worked)
g. Overtime pay
h. Total pay
Overtime pay is calculated only for nonexempt employees. An employee is exempt if 'Y' appears in the exempt column. Overtime is paid at time-and-a-half for all hours worked over 40. If an exempt employee works over 40 hours or under 40 hours, that employee is only paid for 40 hours of work.
For the sample data file the resultant output file would have the following content:
Emp. No. Department Rate Exempt Hours Base Overtime Total
101 41 8.11 Y 49 $324.40 $0.00 $324.40
722 32 7.22 N 40 $288.80 $0.00 $288.80
1273 23 5.43 Y 39 $217.20 $0.00 $217.20
2584 14 6.74 N 45 $269.60 $33.70 $303.30
Your program should be modular and use functions for the bulk of the code in your main function.
Also don't forget to use internal comments.