Salary Lab

In this lab you are going to write a time card processor program. Your program will read in a file called salary.txt. This file will include a department name at the top and then a list of names (string) with a set of hours following them. The file I test with could have a different number of employees and a different number of hours. There can be more than 1 department, and at the end of the file the letters “EOF” will be present. 
An example file:
The Department of Bee’s
 Bill 8 7 8 9 7 F1
 Bob 205103 0.08 F3
 Betty 8 8 7 8 8 F2
 Brandon 10 10 9 6 9 F2
 Brad 9 8 10 9 9 4 1 F4
The Sales Department
 Kyle 88840 0.105 F3
 Tyler 105203 0.085 F3
 Konner 8 6 7 6 9 F2
 Sam 309011 0.045 F3
 Kent 9 8 9 9 9 0 0 F4
 EOF
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 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 * 10.25
 F2 = (The total number of hours – 35) * 18.95 + 400
 F3 = The total sales amount * the commission rate
 F4 = The first 5 hourly totals * 22.55 + Any remaining hourly totals * 48.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…
Each department will have at least 1 employee and each department will contain the word “Department.”
The Department of Bee’s
 Total Salary: $##.##
 Total Hours: ###
 Total Number of Employees: ##
   
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 Department
 Total Salary: $##.##
 Total Hours: ###
 Total Number of Employees: ##
   
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 the program. What are the possible things that the file can have that you need to anticipate? What are the actions that you need to take (read the file, add up hours…)? Are those actions things that could be placed in separate functions? What about the function – can you guess some of the things that will happen? Such as, using substring to pull out part of a line in the file maybe using stoi to convert a string to an integer to add it to the total or creating variables to hold the employee type you find before passing it to another function. Finally, how are these functions called, what is the order and what information is passed to and from? Take all of this and write a flow chart to the best of your abilities that will serve as a guide when programming (as well as being turned in for credit). Possible flowcharting options: Word, Dia, https://www.draw.io/
Scoring Breakdown
25% program compiles and runs
 25% program reads in and calculates the figures for output
 25% outputs the correct information in a clear format 
 25% Flowchart depicting your solution (preferably as an image file like png or pdf)
5% bonus to those who can output the F# responses in a columned output like that shown above.
 5% bonus to those who do a chart comparing the data at the end to show the relation between the pay grades and the amount of salary spent in each (they style of chart is up to you and more points may be given for more difficult charts (like a line chart):
   
B Department
 F1 - 00000000
 F2 - 000000
 F3 - 00000
 F4 - 000000000000 
K Department
 F1 - 0
 F2 - 0000
 F3 - 0000000000
 F4 - 0000000 
  
Or event something like this instead:
0 
 0 0 
 0 0 0
 0 0 0 0
 0 0 0 0
 F1 F2 F3 F4
  1. Question Attachments

    0 attachments —

Answer Detail

Get This Answer

Invite Tutor