Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment, write a program that will act as a wage calculator for a si

ID: 3541771 • Letter: F

Question

For this assignment, write a program that will act as a wage calculator for a single user.

The program should prompt the user to enter the number of hours that they worked and their hourly wage. Those values will then be used to calculate:

The Gross Pay is based upon the number of hours that were worked. If the user worked 40 hours or less, then:

If the user worked more than 40 hours, then:

The Amount of Deductions is based up the gross pay. If the user earned $100.00 or less, the deductions are 2% of the gross pay. If the user earned between $100.01 and $500.00, inclusive, the deductions are 5% of the gross pay. If the user earned more than $500.00, the deductions are 9% of the gross pay.

The Net Pay is based upon the gross pay and the deductions.

After all of the values have been calculated, display a simple table that contains: the number of hours worked, hourly wage, gross pay, amount of deductions, and net pay.

All of the dollar amounts should be displayed with exactly 2 digits after the decimal point.

The number of hours worked should be an integer value. The dollar amounts should all be float or double values. Use meaningful variable names.

Explanation / Answer

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int hours_worked;
double gross_pay,deductions,net_pay;
double hourly_wage = 24;
cout << "Enter the number of hours worked :";
cin >>hours_worked;
cout << endl;
cout << "Enter hourly wage :";
cin >>hourly_wage;
cout << endl;
if(hours_worked<40)
gross_pay = hours_worked *hourly_wage;
else if(hours_worked>40)
gross_pay = 40 *hourly_wage + (hours_worked-40)*hourly_wage*1.5;

if(gross_pay <=100)
deductions = 0.02*gross_pay;
else if(gross_pay>=100 && gross_pay<=500)
deductions = 0.05*gross_pay;
else
deductions = 0.09*gross_pay;
net_pay =gross_pay- deductions;
cout <<"total number of hours worked is " << fixed << setprecision(2) << hours_worked << endl;
cout <<"hourly wage is " << fixed << setprecision(2) << hourly_wage << endl;
cout <<"gross pay is " << fixed << setprecision(2) << gross_pay << endl;
cout <<"amount of deductions are " <<fixed << setprecision(2) << deductions << endl;
cout <<"net pay is " << fixed << setprecision(2) << net_pay << endl;
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote