Program 3, Payroll.
Short Description:
Write a program which will process a payroll for a small company.
This assignment is worth 50 points.
My Design
My design is here.
Goals
When you finish this program, you should:
- Developed your program design skills.
- Demonstrate your ability to use file input and output
- Demonstrate your ability to work with floating point numbers.
Formal Description
You work for a small company and have been asked to produce a program which will
maintain a simple payroll system. This system consists of a file for each employee and a master file.
The master file, called timeclock.data contains one line for each of the three employees. Each line
contains the the name of an employee file and the number of hours that employee worked. For example if the file is:
bob 22.2
big_Boss 55.4
IT_Guy 80.0
The files bob.emp, big_Boss.emp and IT_Guy.emp will be processed.
Each employee file contains the following data (each on a different line):
- Line 1: Hourly wage, a floating point number
- Line 2: Employee name, last,first.
- Line 3: Year to date hours, a float.
- Line 4: Year to date pay, a float.
- Line 5: Employee Number, a string.
The following is an example of an employee file:
10.25
Worker,Mary Jo
20.0
2050.00
123ABC
Note that the employee name may contain spaces.
Your pgoram should open the master file and use the information contained in this file to update the individual employee files. To process an employee file, read in all of the data, compute current pay and accumulate totals, and save the
data back to the employee file. Finally, print a single report line to the
screen.
The report line should be as follows:
- Name, in the form firstname lastname. 20 spaces.
- Hours worked this pay period, 5 spaces, one decimal point.
- Salary for this pay period, 7 spaces, two decimal points.
So for the example above, the output line should be:
Mary Jo Worker 22.2 227.55
Discussion
You should make appropriate use of constants and variables.
Your identifiers should be constructed properly, with meaningful names.
You should document your code with comments.
Your output should be organized, easy to read, and make appropriate use of white space.
Your program should require no user interaction.
Your program should always read from "timecard.data". "timeclock.data".
Indiviual album file names are contained in "timecard.data" "timeclock.data", and should have ".emp" appended to them.
Design
You should design this program, including an algorithm, before you implement the code. This design should be a submitted on Friday Oct 14, and should include:
- A high level description of the program.
- An algorithm.
- This should include a main algorithm for processing the
timecard.data timeclock.data file.
- It should include a sub algorithm for processing an individual employee file.
- A hand trace of your algorithm with the above input.
- A list of questions associated with the assignment.
Required Files
A single source code file and a design document.
Submission
Email your final source code file to danbennett360@gmail.com.