Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Try to modify the program to solve the following problem. Problem: A company pays its hourly workers once a week. An employees pay is based

Try to modify the program to solve the following problem.

Problem: A company pays its hourly workers once a week. An employees pay is based upon the number of hours worked (to the nearest half hour) and the employees hourly pay rate. Weekly hours exceeding 40 are paid at a rate of time and a half. Every employee need to pay 2.9% on all his/her wages for Medicare and 12.4% on all his/her wages for Social Security. Finally an employees gross pay is over $100 a week must pay union dues of $15 per week. Write a payroll program that will determine the gross pay and net pay for an employee.

GIVEN CODE:

// Computes and displays gross pay and net pay given an hourly // rate and number of hours worked. Deducts union dues of $15 // if gross salary exceeds $100; otherwise, deducts no dues. #include  using namespace std; // Functions used ... void instructUser(); float computeGross(float, float); float computeNet(float); const float MAX_NO_DUES = 100.00; // max earnings before dues (dollars) const float dues = 15.00; // dues amount (dollars) const float MAX_NO_OVERTIME = 40.0;// max hours before overtime const float OVERTIME_RATE = 1.5; // overtime rate int main () { float hours; // input: hours worked float rate; // input: hourly pay rate (dollars) float gross; // output: gross pay (dollars) float net; // output: net pay (dollars) // Display user instructions. instructUser(); // Enter hours and rate. cout << "Hours worked: "; cin >> hours; cout << "Hourly rate: "; cin >> rate; // Compute gross salary. gross = computeGross(hours, rate); // Compute net salary. net = computeNet(gross); // Print gross and net. cout << "Gross salary is " << gross << endl; cout << "Net salary is " << net << endl; getch(); return 0; } // Insert lower-level functions here. // ... // Displays user instructions void instructUser() { cout << "This program computes gross and net salary." << endl; cout << "A dues amount of " << dues << " is deducted for" << endl; cout << "an employee who earns more than " << MAX_NO_DUES << endl << endl; cout << "Overtime is paid at the rate of " << OVERTIME_RATE << endl; cout << "times the regular rate for hours worked over " << MAX_NO_OVERTIME << endl << endl; cout << "Enter hours worked and hourly rate" << endl; cout << "on separate lines after the prompts." << endl; cout << "Press  after typing each number." << endl << endl; } // end instructUser // FIND THE GROSS PAY float computeGross (float hours, // IN: number of hours worked float rate) // IN: hourly pay rate (dollars) { // Local data ... float gross; // RESULT: gross pay (dollars) float regularPay; // pay for first 40 hours float overtimePay; // pay for hours in excess of 40 // Compute gross pay. if (hours > MAX_NO_OVERTIME) { regularPay = MAX_NO_OVERTIME * rate; overtimePay = (hours - MAX_NO_OVERTIME) * OVERTIME_RATE * rate; gross = regularPay + overtimePay; } else gross = hours * rate; return gross; } // end computeGross // Find the net pay float computeNet (float gross) // IN: gross salary (dollars) { // Local data ... float net; // RESULT: net pay (dollars) // Compute net pay. if (gross > MAX_NO_DUES) net = gross - dues; // deduct dues amount else net = gross; // no deductions return net; } // end computeNet 

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

More Books

Students also viewed these Databases questions

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago