Payroll Lab You will be taking in a file (payroll.txt) which details a number of departments (at least 1) and in each de
Posted: Fri Jul 01, 2022 5:51 am
Payroll Lab
You will be taking in a file (payroll.txt) which details anumber of departments (at least 1) and in each department are a setof employees (each department will have at least 1 employee or itwould not appear on the payroll sheet). Your job is to read thefile in separate out each employee and calculate the total values(hours, salary, number of employees) for each department and ineach category (F1, F2, F3, F4). In your final submission pleaseinclude the .cpp file which should work for any kind ofpayroll file I supply (which will naturally match the format of theexamples below). Be sure to indicate in your submission file if youhave attempted any of the bonus points .
An example file (note that your program needs to be able tohandle any file formatted in a similar way):
The IT DepartmentBill 8 hours 20 minutes 7hours 8hours 30 minutes 9hrs 10min 57minutes F1Betty 8hrs 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2Brandon 10hours 10hours 5 minutes 9 hours 5 hours 55 minutes 9hours 5 minutes F2Brad 9hrs 8hrs 10hrs 12min 9hrs 4min 8hours 6min 3hrs 24min 1hr6min F4
The Sales DepartmentKyle $24,000 0.105 F3Tyler $18,203 0.085 F3Konner 8hrs 6hrs 5min 7hrs 6 hrs 9 hrs 8 min F2Sam $30,011 0.045 F3Kent 9hrs 8hrs 1min 9 hrs 7hrs 5 min 8 hrs 55min 6min 1hrF4
The Overseas DepartmentJim $24,000 0.105 F3
Frank 7 hours 10 minutes 6hours 1 minute 1 hour 50 minutes8hours 10min 1hour 34 minutes F1Lester 8hrs 5min 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2EOF
First there is the name of the employee, followed by a list oftimes (for f1, f2 and f4). The times are reported by a number ofdifferent systems and the hours and minutes may be representeddifferently. Hours and hrs, or Minutes an mins. The final timesshould be rounded to the nearest half hour, where for example 2hours and 15 minutes would be 2.5 hours. The times may specify thehours and minutes or just one or the other. And yes they could onlywork for a few minutes (maybe they only run into work to sign apaper or something). The last in the row after the hours comes thepay grade (F1, F2, F3, F4). The number of hours recorded is basedon the pay grade of the employee. F1 and F2s will have 5 numbersfor their hours. F3s a bit different since they are commissionbased where a sales amount and a commission percentage is given.F3s are also assumed to work 30 hours if their commission is 10% orbelow and 40 hours if their commission is above 10%. F4s will have7 numbers (as they are on-call during the weekend). Each of the paygrades will also have different pay calculations which are asfollows:
F1 = The total number of hours * 12.15F2 = (The total number of hours – 35) * 18.95 + 500F3 = The total sales amount * the commission rateF4 = 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 totalnumber of hours, and the total number of employees. After that youshould have a breakdown of each category of employee: F1 total payand total hours, F2 total pay and total hours…
Each department will have at least 1 employee and eachdepartment will contain the word “Department.”
The IT DepartmentTotal Salary: $##.##Total Hours: ###Total Number of Employees: ##Roster: Bill, Bob, Betty, Brandon, Brad
F1:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F2:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F3:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F4:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
The Sales DepartmentTotal Salary: $##.##Total Hours: ###Total Number of Employees: ##Roster: Kyle, Tyler, Konner, Sam, Kent
F1:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F2:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F3:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F4:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
Before coding your solution, take the time to design theprogram. What are the possible things that the file can have thatyou need to anticipate? What are the actions that you need to take(read the file, add up hours…)? Are those actions things that couldbe placed in separate functions? What about the function – can youguess some of the things that will happen? Such as, using substringto pull out part of a line in the file maybe using stoi to converta string to an integer to add it to the total or creating variablesto hold the employee type you find before passing it to anotherfunction. Finally, how are these functions called, what is theorder and what information is passed to and from?
Scoring Breakdown
25% program compiles and runs30% program reads in and calculates the figures for output10% the program is appropriately commented35% outputs the correct information in a clear format
5% bonus to those who can output the F# responses in a columnedoutput like that shown above.5% bonus to those who do a chart comparing the data at the end toshow the relation between the pay grades and the amount of salaryspent in each (they style of chart is up to you and more points maybe given for more difficult charts (like a line chart):
B DepartmentF1 - 00000000F2 - 000000F3 - 00000F4 - 000000000000
K DepartmentF1 - 0F2 - 0000F3 - 0000000000F4 - 0000000
Or event something like this instead:
0 0 0 0 0 00 0 0 00 0 0 0F1 F2 F3 F4
You will be taking in a file (payroll.txt) which details anumber of departments (at least 1) and in each department are a setof employees (each department will have at least 1 employee or itwould not appear on the payroll sheet). Your job is to read thefile in separate out each employee and calculate the total values(hours, salary, number of employees) for each department and ineach category (F1, F2, F3, F4). In your final submission pleaseinclude the .cpp file which should work for any kind ofpayroll file I supply (which will naturally match the format of theexamples below). Be sure to indicate in your submission file if youhave attempted any of the bonus points .
An example file (note that your program needs to be able tohandle any file formatted in a similar way):
The IT DepartmentBill 8 hours 20 minutes 7hours 8hours 30 minutes 9hrs 10min 57minutes F1Betty 8hrs 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2Brandon 10hours 10hours 5 minutes 9 hours 5 hours 55 minutes 9hours 5 minutes F2Brad 9hrs 8hrs 10hrs 12min 9hrs 4min 8hours 6min 3hrs 24min 1hr6min F4
The Sales DepartmentKyle $24,000 0.105 F3Tyler $18,203 0.085 F3Konner 8hrs 6hrs 5min 7hrs 6 hrs 9 hrs 8 min F2Sam $30,011 0.045 F3Kent 9hrs 8hrs 1min 9 hrs 7hrs 5 min 8 hrs 55min 6min 1hrF4
The Overseas DepartmentJim $24,000 0.105 F3
Frank 7 hours 10 minutes 6hours 1 minute 1 hour 50 minutes8hours 10min 1hour 34 minutes F1Lester 8hrs 5min 8hrs 30min 7hrs 5min 8hrs 7hrs 10min F2EOF
First there is the name of the employee, followed by a list oftimes (for f1, f2 and f4). The times are reported by a number ofdifferent systems and the hours and minutes may be representeddifferently. Hours and hrs, or Minutes an mins. The final timesshould be rounded to the nearest half hour, where for example 2hours and 15 minutes would be 2.5 hours. The times may specify thehours and minutes or just one or the other. And yes they could onlywork for a few minutes (maybe they only run into work to sign apaper or something). The last in the row after the hours comes thepay grade (F1, F2, F3, F4). The number of hours recorded is basedon the pay grade of the employee. F1 and F2s will have 5 numbersfor their hours. F3s a bit different since they are commissionbased where a sales amount and a commission percentage is given.F3s are also assumed to work 30 hours if their commission is 10% orbelow and 40 hours if their commission is above 10%. F4s will have7 numbers (as they are on-call during the weekend). Each of the paygrades will also have different pay calculations which are asfollows:
F1 = The total number of hours * 12.15F2 = (The total number of hours – 35) * 18.95 + 500F3 = The total sales amount * the commission rateF4 = 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 totalnumber of hours, and the total number of employees. After that youshould have a breakdown of each category of employee: F1 total payand total hours, F2 total pay and total hours…
Each department will have at least 1 employee and eachdepartment will contain the word “Department.”
The IT DepartmentTotal Salary: $##.##Total Hours: ###Total Number of Employees: ##Roster: Bill, Bob, Betty, Brandon, Brad
F1:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F2:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F3:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F4:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
The Sales DepartmentTotal Salary: $##.##Total Hours: ###Total Number of Employees: ##Roster: Kyle, Tyler, Konner, Sam, Kent
F1:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F2:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F3:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
F4:Total Salary: $##.##Total Hours: ###Total Number of Employees: ##
Before coding your solution, take the time to design theprogram. What are the possible things that the file can have thatyou need to anticipate? What are the actions that you need to take(read the file, add up hours…)? Are those actions things that couldbe placed in separate functions? What about the function – can youguess some of the things that will happen? Such as, using substringto pull out part of a line in the file maybe using stoi to converta string to an integer to add it to the total or creating variablesto hold the employee type you find before passing it to anotherfunction. Finally, how are these functions called, what is theorder and what information is passed to and from?
Scoring Breakdown
25% program compiles and runs30% program reads in and calculates the figures for output10% the program is appropriately commented35% outputs the correct information in a clear format
5% bonus to those who can output the F# responses in a columnedoutput like that shown above.5% bonus to those who do a chart comparing the data at the end toshow the relation between the pay grades and the amount of salaryspent in each (they style of chart is up to you and more points maybe given for more difficult charts (like a line chart):
B DepartmentF1 - 00000000F2 - 000000F3 - 00000F4 - 000000000000
K DepartmentF1 - 0F2 - 0000F3 - 0000000000F4 - 0000000
Or event something like this instead:
0 0 0 0 0 00 0 0 00 0 0 0F1 F2 F3 F4