CMPS 1044 - Program #1 – Employee Payroll - Spring...

advertisement
CMPS 1044 - Program #1 – Employee Payroll - Spring 2016
Problem Solving Steps DUE: Monday, February 22 – 10 % of grade, not accepted late
DUE: Monday, February 29 – 5 points off for each day late, including weekends
Implement the payroll program using file input and file output. Use a while loop (as shown
below) to process the payroll for 10 different employees. For each employee enter the
employee’s id number, number of hours worked, and hourly pay rate.
Calculate the gross pay. (All hours are paid at the hourly rate, no extra for overtime.) Then
compute the following deductions and the final net pay based on the following percentages of
the gross pay or the flat rate.
 Income Tax is 15% (of gross pay)
 FICA is 8.25%
 Payroll Savings is 5%
 Retirement is 5%
 Health Insurance is $ 50.00
Create a data file of the following data: (IdNumber, Hours, HourlyPay)
4218
40
12.93
5478
30
48.25
6723
50
20.79
1234
12.5
9.56
3567
15.6
15.99
7878
47.3
25.00
5633
13.9
7.75
4590
60
15.50
8998
18.9
9.00
4331
45.21
28.99
Output is to be in exactly the following form. Insert correct information in place of
parentheses. Print your name only once. Draw a line between each employee’s information.
The x’s represent where your answers will be placed. Must use I/O manipulators.
Student Name: (Your name) // print this line ONLY ONCE
Employee: (id number)
Gross Pay
Federal Income Tax
FICA
Payroll Savings
Retirement
Health Insurance
$ xxxxx.xx
$ xxxxx.xx
$ xxxxx.xx
$ xxxxx.xx
$ xxxxx.xx
$ xxxxx.xx
Net Pay
$ xxxxx.xx
* ** Repeat this part
10 times, once
for each employee.
Program Template
int main ( )
{ int count = 1;
// other declarations & code here
while (count <=10)
{
// Put your code here
count = count + 1;
}
}
Other notes:
* I recommend that you get the program running using cin/cout statements then change or add
the file I/O once it is working properly.
* Check several of your data items by hand to make sure your answers are correct.
* Double check you data input file to make sure there are no typing errors.
* Turn in your program listing, the listing of your output file, and the listing of your input file.
* Use type double for all your numeric variables.
* Watch carefully for errors due to mixed type arithmetic.
* Double check your alignment & spacing (I/O Manipulators)
* Programs that do not compile will be returned without grading for redo – late days count
Download