Features of
ezpay
Input Format
Input is a timesheet containing a list of employees (one
per line) with their hourly wage followed by the hours they
worked each day during the week. Each line consists of
eight fields. Each input field may be separated by one or
more spaces or tabs. The eight fields are: first name, last
name, hourly wage (a number), and hours (a number) for each
day of the week (Monday-Friday).
Data errors
The hours must be integers (i.e., no decimal point) between
0 and 24 inclusive. The wage may or may not have a decimal
point. However, it should not have any fractional pennies
(e.g., 10.005 has 1/2 a penny). Any deviation from
the above rules results in a "Data Error".
Format Errors
Any deviation from the following results in a "Format
Error". Names (first and last) should be both no longer
than 15 characters. Names may only consist of the following
characters [-a-zA-Z0-9.].
Duplicate Errors
If any name appears more than once in the input file (in
any mixture of lower or upper case letters), then an error
message will appear in the output file for each subsequent
duplicated employee. The payroll calculation in the output
file will use the first instance of the employee from the
input file and assume that this first line has the correct
data.
Weekly wage computation
For the first forty hours worked in the week, the wage is
calculated by multiplying the hourly wage with the number
of hours. After forty hours the overtime kicks in when
employees get a time and a half for the additional hours.
For example, if an employee gets $10/hour and works 41
hours in the week, she will get 40*10 + 1*15 dollars for
the week.
Output
The output first lists all the errors. For each error, the
output includes the entire input line followed by the kind
of error on the line ("Format Error" or "Data Error"). Then
it lists all the remaining employees with their hours for
the week and weekly wage.
Sample inputs and output
-------------------------------------------
Given the following timesheet as input:
Eric Error -10.00 8 8 8 8 8
Evan Error 10.00 -8 8 8 8 8
Ellen Error 10.00 25 8 8 8 8
Ernie Error 10.00 8.5 8 8 8 8
John Doe 10.00 10 10 10 10 10
Jane Doe 10.00 8 8 8 8 8
Bob Smith 12.00 8 8 8 8 8
Bob Smith 10.00 9 9 9 9 9
Bob Smith 10.00 9 9 9 9 9
EZPay will produce the following output:
Eric Error -10.00 8 8 8 8 8 ** DATA ERROR **
Evan Error 10.00 -8 8 8 8 8 ** DATA ERROR **
Ellen Error 10.00 25 8 8 8 8 ** DATA ERROR **
Ernie Error 10.00 8.5 8 8 8 8 ** FORMAT ERROR **
Bob Smith 10.00 9 9 9 9 9 ** DUPLICATE ERROR **
Bob Smith 10.00 9 9 9 9 9 ** DUPLICATE ERROR **
Name Hours Payment
Jane Doe 40 $400.00
John Doe 50 $550.00
Bob Smith 40 $480.00
------------------------------- ----- ------------
Total 130 $1,430.00