ProductsLogo
LogoStudy Documents
LogoAI Grader
LogoAI Answer
LogoAI Code Checker
LogoPlagiarism Checker
LogoAI Paraphraser
LogoAI Quiz
LogoAI Detector
PricingBlogAbout Us
logo

Programming Assignment 1: Employee Payroll Register

Verified

Added on  2019/09/16

|2
|567
|244
Project
AI Summary
The assignment is to write a C++ program that reads employee data from a file named emp_data.txt, calculates payroll for each employee based on their hours worked and pay rate, and stores the payroll register in another file named emp_pay.txt.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
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.

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
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.
1 out of 2
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]