Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 This Is the DATA to put in : Input File: 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. The following code can be used to read in the data #include  #include  #include  using namespace std; int main () { char cname[20]; double rate, hours; char inscode; while (cin.get(cname,21)) // read in 20 chars { string name = cname; cin >> rate >> hours >> ws >> inscode >> ws; cout << "|" << name; cout << "|" << rate; cout << "|" << hours; cout << "|" << inscode; cout << "|" << endl; } return 0; } 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago