An employee is paid $16.78 per hour for up to 40 hour per week. Hours over 40 ar
ID: 3648497 • Letter: A
Question
An employee is paid $16.78 per hour for up to 40 hour per week. Hours over 40 are paid at the overtime rate of 1.5 *16.78. From the employee's weekly pay , 6% is withheld for Social Security tax, 14% is withheld for the Federal Income Tax, 5% is withheld for state income tax, and $ 10 is withheld for union dues.1) prompts the user to enter the number of hours worked in the last week.
2) The program checks that the user did, in fact, entered a positive value. If not, output an error message. Otherwise echo the user's input (something like "Now processing the value 15 or 40...")and continue with step 3.
3) Display the workers weekly gross pay(before withholding), the type and amount of each
withholding, and the net pay (after every withholding).
4) Create your program so that it will repeat the process until the user wishes to exit. This will allow the user to compute the pay data for more that once week during one execution.
Explanation / Answer
please rate - thanks
#include <iostream>
using namespace std;
int main()
{double rate=16.78,gross, sstax,fedtax,statetax,hours,net,uniond=10;
int again;
do
{cout<<"Enter hours worked: ";
cin>>hours;
while(hours<=0)
{cout<<"must be positive ";
cout<<"Enter hours worked: ";
cin>>hours;
}
cout<<"Now processing the value "<<hours<<endl;
if(hours<=40)
gross=rate*40;
else
gross=rate*40+(hours-40)*rate*1.5;
sstax=gross*(6/100.);
fedtax=gross*(14/100.);
statetax=gross*(5/100.);
net=gross-sstax-fedtax-statetax-uniond;
cout<<"Summary ";
cout<<"Gross: "<<gross<<endl;
cout<<"Union: "<<uniond<<endl;
cout<<"Federal: "<<fedtax<<endl;
cout<<"Social Security: "<<sstax<<endl;
cout<<"State tax: "<<statetax<<endl;
cout<<"enter 1 to continue, 2 to exit ";
cin>>again;
}while(again==1);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.