Programming Assignment

Employee Payroll

 

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

   15.75
 2    52.5

   17.50
 3    40.0

   14.00
 4    50.0

   14.00
 5   5.25

  12.25

The first column contains the number of the employee, the second column is the number of hours worked, and the third is the hourly pay rate.

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) :

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.

Use precision - to print out only 2 numbers after the decimal.
Make sure to comment each function.
You need to hand in: the program, payroll.data, and payroll.out.