Object: To process the weekly payroll in a company of one or more employees. Each employee has worked 5 days in the week and the number of hours of work per day is a number from 1 to 8.
The information about a date is the same as in Lab2: So you will use the structure in the header file Date.h.
For this assignment, you will use the structure Employeelnfo defined in the header file Employeelnfo.h to hold the information about an employee.
Create and save in your C$240 directory the file lab3.input that contains the information about the employees: use one line of input for each employee. For example:
58243 John Doe 10 25 1981 615 2005 8.75 7475 8
Is for an employee with ID number: 58243; first name: John; last name Doe date of birth: 10/2511981, date hired: 6/1512005; pay rate: $8.75; who has worked for 7, 4, 7, 5, and 8 hours respectively.
NB: The dummy ID number -99 is used to end the input data.
Write a program that does the following for each of the employees:
reads the information about the employee: the number hours read in a loop and their sum is stored in the structure as the number of hours worked during the week.
computes his/her gross pay: the gross pay is the pay rate times the number of hours work.
computes his/her tax deduction as follows:
The net pay is the gross pay minus the tax deduction.
Also compute the total gross pay and total tax deduction of the company and print it.
Compile, link and execute your program in UNIX computer using I/O redirection.
The output should look like the following(for each employee):
Pay Rate: $15.00
Gross Pay: $558.00
Net Pay: $502.20
Leave two lines between the employees. Return the source file, the header files, the input file, and the output file in this order.
Extra Credit: rewrite the program by assuming that each employee can work one or more days. Use the dummy hours -99 to end the input of an employee's number of hours. For example the information about an employee who has worked only three days is as follows:
58243 John Doe 10 25 1981 6 15 2005 8.75 7 4 7 -99