Project 3 c++ Objective: The purpose of this project is to expose you to: One-di
ID: 3723032 • Letter: P
Question
Project 3 c++
Objective:
The purpose of this project is to expose you to:
One-dimensional parallel arrays, input/output, Manipulating summation, maintenance of array elements. In addition, defining an array type and passing arrays and array elements to functions.
Problem Specification:
The PC Pine Furniture Company has recently hired you to help them generate a payroll report for all their employees. You are given a data file containing the employee’s data. The data for each employee consists of the employee id, name, hours worked and rate of pay. The number of employees in the file is unknown. However; the last employee id number is 0. You are to read this data into parallel arrays, calculate the gross pay, federal withholdings, state withholdings, Social Security withholding and net pay for each employee and store each in an array. You should define the followings as constants:
Federal withholding tax rate: 17.5%
State withholding tax rate: 5.5%
Social Security withholding: 2.5%
Your output should be:
A report for all employees written to a file and consisting of the employee name, id number, gross pay and net pay.
Another report written to a different file containing the total gross pay paid to all employees, total federal withholdings, total state withholdings, total Social Security withholding and total for all withholdings.
Requirements:
Comment thoroughly.
Every function must have specifications in the form of comments.
Create global constants.
Make sure every function accomplishes a task and is self-contained
Use typedef to define new types as necessary.
Each file has a heading and column labels to identify information.
Must test if data file exists before reading data, and do not change my data.
You may need to write additional functions such as total, which returns the total of an array.
main is used as a driver function, no input/output or calculations is done in main, only what is specified.
Grading Criteria:
5 points there are sufficient comments in the program.
5 points typedef is used to define all arrays.
5 points a flowchart of the function main () “only main ()” is included and is correct. No pseudo-code will be accepted.
5 points a counter is used to count the number of elements read.
5 points generate an error if file does not exist, or if not open.
5 points a loop reads the data until the trailing value 0 for ID is encountered.
5 points each function have clear, full and thorough specifications.
5 points the function setdata () reads the data from the file into arrays.
5 points the function setdata() returns the number of employees read from the file as its value.
5 points the function findgross () fills the gross array with calculated data.
5 points the function findwithholding () accepts the needed data for an employee and returns the withholdings.(I don't know how to return an array from an function without using pointer and vector. And also read that array[index++] does not affect the value of array[index].)
5 points the function findwithholding () is reused to calculate different withholding.
5 points the function findnet() fills the net array with calculated data.
5 points the function total () will return the total of its array argument. (reused).
5 points headings (), prints the headings and column titles, formatted and looks nice.(i don’t know how to use iomanip to print like a table).
5 points data/calculated results are printed with proper spacing and proper formatting.
20 points the program runs according to specifications above, and produces the intended results.
5 points source program, flowchart, data file and output files are submitted.
Submission Details:
Submit a print-out of:
The source files
Hierarchical chart
A flowchart (pseudo code is not acceptable)
A copy of the input data file
A copy of the output files.
*** ***
Explanation / Answer
/*OUTPUT
*/
There are 15 employees. Count: 15 0 211692 Ahmed, Marco 47 12.5 Gross pay $587.5 1 240885 ATamimi, Trevone 30 15 Gross pay $450 2 281393 Choudhury, Jacob 10 10 Gross pay $100 3 272760 De la Cruz, Edward 25 22.25 Gross pay $556.25 4 199593 Edwards, Faraj 60 11.75 Gross pay $705 5 256109 Edwards, Bill 45 30.5 Gross pay $1372.5 6 246779 Gallimore, Christian 8 15 Gross pay $120 7 270081 Lopez, Luis 18 16 Gross pay $288 8 114757 Mora, Sam 37 13.2 Gross pay $488.4 9 270079 Moses, Samuel 48 9.5 Gross pay $456 10 193280 Perez, Albert 52 17.75 Gross pay $923 11 252830 Rivas, Jonathan 32 23.25 Gross pay $744 12 252830 Robinson, Albert 39 11 Gross pay $429 13 276895 Miranda, Michael 28 18 Gross pay $504 14 280515 Robinson, Iris 45 22.25 Gross pay $1001.25 Program ended with exit code: 0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.