Write a program that generates an Employee Payroll. All output should go to payroll.out.
The input for the program should be read from a file, payroll.data.
Payroll.data should contain the following information for 5 employees:
| 1 | 15.0 |
|
| 2 | 52.5 |
|
| 3 | 40.0 |
|
| 4 | 50.0 |
|
| 5 | 5.25 |
|
Your program should perform the following tasks:
First call a function printPersonalInfo() which will not receive any parameters and will not return a value. This function will print your name and a description of the program to the output file, payroll.out.
For each employee you are to read in their id, hours, and pay rate from the input file, payroll.data and print them out to the output file.
Next you should call a function calculateEmployeeData() and pass in two parameters: hours and pay rate. Your function calculateEmployeeData() should compute and print to the output file the number of overtime hours worked by that employee, their overtime pay, and their total salary. An employee earns straight time for the first forty hours of work and double-time for any additional hours. For example if an employee worked 45 hours earning $10 and hour, then the employee's overtime hours would be 5, their overtime pay would be $100.00 and their total pay would be $500.00. The function should return the total salary.
Then, your main program should call a function, checkHours() passing in hours to the function. The function checkHours() prints out the following messages to the output file (You must use nested if-else statments (i.e. USE else if) :
- If hours is less than 10 print a message saying that the employee has worked too little.
- If hours is between 10 and 20, print a message saying the employee should work more than 20 hours a week.
- If hours is between 20 and 40 it should print a message thanking the employee for putting in the time.
- Otherwise (greater than 40 hours), it should print a very nice message letting the employee know that s/he has gone above and beyond what is required.
After there are no more employees to process, the program should print out to the output file the total number of hours and total salary for all employees combined.