CIS 2003 - Introduction to
C++ and C Programming
Bob Comer, Professor, CIS/CSC
Assignment 6 - Payroll Program
Be sure to read chapters 11 and 14 before starting this assignment. Your job
is to write a payroll program for Armadillo Automotive.
Program input
The program input consists of two files - a master file and a transaction
file.
Master file
The master file has one line of input per employee containing:
- employee ID number
- name (20 characters)
- pay rate per hour
- number of dependents
- type of employee (0 for
union, 1 for management)
- sex ('M' or 'F')
You can assume a maximum of 100 employees.
Transaction file (weekly timesheet information)
The transaction file has one line for each employee who worked containing:
- employee id number
- number of hours worked for
the week
This file may have any number of transactions.
Calculations
- Gross Pay - Union members are
paid 1.5 times their normal pay rate for any hours worked over 40.
Management employees are paid their normal pay rate for all hours worked
(they are not paid extra for hours over 40).
- Tax - All employees pay a
flat 15% income tax.
- Insurance - The company pays
for insurance for the employee. Employees are required to buy insurance
for their dependents at a price of $20 per dependent.
- Net Pay is Gross Pay minus
Tax minus Insurance.
Program output
The program output will consist of two reports:
Error and Control Report
- Prints the transaction file
input lines for which there is no matching master file record or the hours
worked is invalid (a negative number). These lines should be ignored (no
further processing is done for the line) and processing continues with the
next transaction.
- Prints the total number of
transactions that were processed correctly during the run.
Payroll Report
The payroll report should be printed in a tabular (row and column) format
with each column clearly labeled. Print one line for each transaction that
contains:
- employee ID number
- name
- tax
- insurance
- gross pay
- net pay
The final line of the payroll report should print the total amount of gross
pay and total amount of net pay for the week.
Hints:
- Global variables are
variables that are declared outside any function. Do not use global
variables in your programs. Declare all your variables inside
functions
- You can assume that the
Master file does not contain errors (error checking is done by another
program). Error checking for the Transaction file is described in the
Error and Control Report.
- You should use either a class
or a struct to represent the master file information for one employee.
- Write the reports to two
separate output files.
- The master file
information should be read into an array.
- Do not read and store the transaction
information in arrays. When you store transactions in arrays, you set a
limit on the number of transactions your program can process. For this
program, you should be able to read and process transactions one at a
time.
Return to C++ Home
Page
Copyright: Ó2000 by the Austin Community College
Department of Computer Studies. All rights reserved.
Comments to: Bob Comer
Last updated: April 5, 2000