Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Payroll Program Write a Payroll Program in C++ that will perform the functions specified below. 1. Print the heading NAME RATE HOURS INS SOC STATE
Payroll Program Write a Payroll Program in C++ that will perform the functions specified below. 1. Print the heading NAME RATE HOURS INS SOC STATE FED NET SEC TAX TAX 2. For each employee, write a loop that will do the following, A. Read a line of data from a file (or from STDIN) B. Compute the gross-pay as rate times hours, if the hours is <=40. Pay double time for overtime (over 40 hours). C. Compute dollar amount of Insurance withholding as: 0.00 if status is None 9.50 if status is Single 24.75 if status is Family D. Compute social security withheld as 7% of gross pay E. Compute state tax as 3% of gross pay F. Compute PYE (Projected Yearly earnings) as gross-pay times 52. G. Compute the federal-tax based on PYE from the following table. 0% if PYE < 8000 15% if 8000 <= PYE < 20000 28% if PYE >= 20000 Using the above tax brackets, compute Federal-Tax withheld as the above percents times PYE occurring in each tax bracket. Example: if PYE is 21000 then yearly federal-tax = (20000-8000)*.15 + (21000-20000)*.28 = 1800 + 280 = 2080 H. Compute Net pay as gross-pay minus insurance minus soc-sec minus state-tax minus fed-tax I. Print a detail line with the above items Input File: 11111111112222222222333 12345678901234567890123456789012 Tom Anderson 7.52 45 N Bob Conerley 17.50 40 S John H. Potter 9.30 35 S Terrance Appleby 31.00 42 F Joseph Rinker 17.00 35 F Todd Russell 5.00 30 S Bill Ryan 18.25 45 N Your output should look similar to the following: (7 rows and 8 columns) NAME RATE HOURS INS SOC STATE FED NET SEC TAX TAX Tom Anderson 7.52 45.00 0.00 26.32 11.28 33.32 305.08 Bob Conerley 17.50 40.00 9.50 49.00 21.00 122.92 497.58 John H. Potter 9.30 35.00 9.50 22.78 9.76 25.74 257.71 Terrance Appleby 31.00 42.00 24.75 95.48 40.92 308.84 894.01 Joseph Rinker 17.00 35.00 24.75 41.65 17.85 93.52 417.23 Todd Russell 5.00 30.00 9.50 10.50 4.50 0.00 125.50 Bill Ryan 18.25 45.00 0.00 63.87 27.37 182.42 638.83 -- use setprecision(2), fixed and setw() to line up the decimals.
Additional requirements for the assignment: Steps B, C and G must be EXTERNAL functions and must be in separate files. There is to be a test program to test out each function. Use the pre-processor directive #if __INCLUDE_LEVEL__ < 1 to facilitate debugging the functions. Use a consistent set of rules for indention - ie those covered in class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started