CS 150 Program 6: Payroll Register

Verified

Added on  2019/09/16

|2
|567
|244
Project
AI Summary
This programming assignment for CS 150 requires students to develop a C++ program that reads employee data from a file, calculates payroll information (including base pay and overtime), and outputs a formatted payroll register to another file. The program must use functions for reading data, calculating pay, and printing report lines, with specific parameter passing methods. Students are also required to submit a design document before the program code. The assignment emphasizes file I/O, function usage, and structured programming practices.
Document Page
Computer Science 1
Programming Assignment 6
Functions & File I/O
60 Points
The data shown below is stored in a file named emp_data.txt. A copy of the data file is in D2L
under Content for Unit 6. The data is stored with no column headings, a space between each
data item and a return after the hours data for each employee.
Employee # Dept. Pay Rate Exempt Hours
205 14 7.54 N 45
3498 64 17.98 Y 38
1328 38 25.75 Y 49
9054 76 10.43 N 42
213 64 8.29 N 47
659 14 7.52 N 41
5487 14 25.75 Y 52
4326 38 7.54 N 36
1267 76 8.29 N 40
Write a program to read the employee file and create a payroll register.
Store the payroll register into a file named emp_pay.txt.
The register should contain the following data:
o Employee number (print left-justified)
o Department
o Pay Rate
o Exempt Status
o Hours Worked
o Base Pay ( base pay = pay rate * hours worked (up to 40 hours))
o Overtime Pay (only calculated for non-exempt employees, time-and-a-half for all
hours worked over 40).
o Total pay
Your report should be printed in column format with a title and the message “End of
Report” at the end.
You should have separate functions to:
o Read a line of data.
o Calculate the Base Pay, Overtime pay, and Total pay for one employee.
o Print one line in the report.
Your program should work with files containing fewer or more records (lines) than those
shown in the table above.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Your main function should print the report and column headings into the output file, then
enter a loop which will:
o Call a function to read a line of data from the input file (use pass-by-reference
parameters to get the data back to main).
o Call a function to calculate the base and overtime pay. (Use pass-by-value for pay
rate, exempt status and hours. Use pass-by-reference for base and overtime
pay.)
o Call a function to write one line of the report to the output file. (Use pass-by-value
for all parameters.)
The loop should iterate while there is data in the file.
*** A similar example program is posted under Content for Unit 6.
Design your program by completing the CS 150 Program Design Document. Be sure to include
a structure chart for the program, the prototype for each function, and a brief description of each
function’s purpose. Save the design in a file named EmpDesign_xxx.doc where xxx are your
initials and submit it in the Program 6 Design drop box by the date shown in the calendar – this
is before the program due date.
Code your program. Save it in a file named employee_xxx.cpp where xxx are your initials.
Compile, run and test your program.
Submit your working .c file in the Program 6 drop box by the due date shown in the calendar.
chevron_up_icon
1 out of 2
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]