Menu

(Solved) : Multiple Function Returns Using Memory Pointers Contents Employeedat Copy Paste Create Fil Q37268305 . . .

“Multiple Function Returns Using Memory Pointers”

Contents of employee.dat… copy paste and create a file(employee.dat)

123-45-6789 Kirk James 44.7 88.99 0.0175
124-89-0007 Bond Jane 45.6 65.75 0.04
405-77-8911 Puff Blossom 40 33.88 0.03
405-10-9871 Puff Buttercup 41.2 45.66 0.047
223-03-8761 Puff Bubbles 37.8 33.44 0.015
980-11-2201 Joneski Kasey 23.1 10.77 0.033
115-88-7619 Crooke I.M.A. 25.4 88.75 0.02
777-00-1232 Smith Alias 43.5 22.3 0.034
345-89-0022 DeMann Stan 56.7 29.45 0.065
210-37-1192 Jones Jeane 48.9 20.33 0.025
103-22-4321 Smith Alias 33.5 19.67 0.063

C++

The problem with using functions is that C++, by default willreturn not more than one value to the calling routine (i.e. main( )for example). Using pointers, we can “return” more than one valueto that calling routine. This allows us to “farm” out intermediatecalculations to functions for later use in the logic and then passthose values on to other functions as needed.

In this exercise, we will read in a data file of employees (fileis furnished to you, “employee.dat”):

1. Employee SSN

2. Employee Last Name

3. Employee First Name

4. Hours Worked

5. Pay Per Hour

6. Personal Income Tax Rate

Your assignment’s logic is to:

1. Read in the records from the file,

2. Pass the Hours Worked, Pay Per Hour, Personal Income Tax Rateto a single function to determine:

3. Whether or not overtime pay is computed (anything over 40hours is overtime at 1.5 times the regular pay). Compute anyovertime pay at 1.5 times pay rate

4. Compute the regular pay at regular hours (40 hours orless)

5. Compute the gross pay (Regular Pay plus any overtime pay)

6. Compute the personal income taxes withheld

7. Compute Net Pay (gross pay minus personal income taxeswithheld)

8. Pass ALL these values BACK to the main calling routine fromthis one function.

9. Display:the Employee SSN, Last Name, First Name, TotalHours, Regular Hours, Overtime Hours (if any), Pay Per Hour,Personal Income Tax Rate, Regular Pay, Overtime Pay (if any),Gross Pay, Withheld Income Taxes, Net Pay.

Expert Answer


Answer to “Multiple Function Returns Using Memory Pointers” Contents of employee.dat… copy paste and create a file (employee.dat…

OR