Payroll Lab

 

You will be taking in a file (payroll.txt) which details a number of departments (at least 1) and in each department are a set of employees (each department will have at least 1 employee or it would not appear on the payroll sheet). Your job is to read the file in separate out each employee and calculate the total values (hours, salary, number of employees) for each department and in each category (F1, F2, F3, F4). In your final submission please include the .cpp file which should work for any kind of payroll file I supply (which will naturally match the format of the examples below). Be sure to indicate in your submission file if you have attempted any of the bonus points .

 

An example file (note that your program needs to be able to handle any file formatted in a similar way):

The IT Department
Bill 8 hours 20 minutes 7hours 8hours 30 minutes 9hrs 10min 57 minutes F1
Betty 8hrs 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2
Brandon 10hours 10hours 5 minutes 9 hours 5 hours 55 minutes 9 hours 5 minutes F2
Brad 9hrs 8hrs 10hrs 12min 9hrs 4min 8hours 6min 3hrs 24min 1hr 6min F4

The Sales Department
Kyle $24,000 0.105 F3
Tyler $18,203 0.085 F3
Konner 8hrs 6hrs 5min 7hrs 6 hrs 9 hrs 8 min F2
Sam $30,011 0.045 F3
Kent 9hrs 8hrs 1min 9 hrs 7hrs 5 min 8 hrs 55min 6min 1hr F4

The Overseas Department
Jim $24,000 0.105 F3

Frank 7 hours 10 minutes 6hours 1 minute 1 hour 50 minutes 8hours 10min 1hour 34 minutes F1
Lester 8hrs 5min 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2
EOF

 

First there is the name of the employee, followed by a list of times (for f1, f2 and f4). The times are reported by a number of different systems and the hours and minutes may be represented differently. Hours and hrs, or Minutes an mins. The final times should be rounded to the nearest half hour, where for example 2 hours and 15 minutes would be 2.5 hours. The times may specify the hours and minutes or just one or the other. And yes they could only work for a few minutes (maybe they only run into work to sign a paper or something). The last in the row after the hours comes the pay grade (F1, F2, F3, F4). The number of hours recorded is based on the pay grade of the employee. F1 and F2s will have 5 numbers for their hours. F3s a bit different since they are commission based where a sales amount and a commission percentage is given. F3s are also assumed to work 30 hours if their commission is 10% or below and 40 hours if their commission is above 10%. F4s will have 7 numbers (as they are on-call during the weekend). Each of the pay grades will also have different pay calculations which are as follows:

F1 = The total number of hours * 12.15
F2 = (The total number of hours – 35) * 18.95 + 500
F3 = The total sales amount * the commission rate
F4 = The first 5 hourly totals * 26.55 + Any weekend hourly totals (the last 2) * 39.75

Your output to the screen should start with the department name, followed by the total pay for all of the employees, then the total number of hours, and the total number of employees. After that you should have a breakdown of each category of employee: F1 total pay and total hours, F2 total pay and total hours

This question has been answered.

Get Answer