82 273
Assignments Done
99,5%
Successfully Done
In January 2020

# Answer to Question #48786 in C++ for ama nae

Question #48786
Write a program that requests the hours worked in a week and then prints the gross pay, the taxes, and the net pay. Assume the following: a. Basic pay rate = \$ 10.00/hr b. Overtime (in excess of 40 hours) = time and a half c. Tax rate: # 15% of the first \$300 20% of the next \$150 25% of the rest
1
2014-11-12T00:37:47-0500
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
using namespace std;
int main()
{
float tax = 0, netPay, grossPay = 0;
float temp;
int temp_hours;
int hours;
cout<<"Enter the hours worked in a week : ";
cin>>hours;
temp_hours = hours;
if (hours > 40 )
{
hours -= 40; grossPay += 400;
grossPay += hours * 15;
}
else
grossPay += hours * 10;
temp = grossPay;
if (temp > 300)
{
temp -= 300;
tax += 300 * 0.15;
if (temp > 150)
{
temp -= 150;
tax += 150 * 0.2;
tax += temp * 0.25;
}
else
{
tax += temp * 0.2;
}
}
else
{
tax += temp * 0.15;
}
netPay = grossPay - tax;
system("cls");
cout<<"Hours : "<<temp_hours<<endl;
cout<<"Tax : "<<tax<<endl;
cout<<"Gross pay : "<<grossPay<<endl;
cout<<"Net pay : "<<netPay<<endl;
system("pause");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!