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

C++: An employee is paid at a rate of $16.78 per hour for regular hours worked i

ID: 3850334 • Letter: C

Question

C++:

An employee is paid at a rate of $16.78 per hour for regular hours worked in a week. Any hours over that are paid at the overtime rate of one and one-half Lmes that. From the worker’s gross pay: • 6% is withheld for Social Security tax • 14% is withheld for federal income tax • 5% is withheld for state income tax • $10 per week is withheld for union dues. • If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and that will then output: • the worker’s gross pay • each withholding amount • The net take-home pay for the week.

Explanation / Answer

In the program i have considered that the regular hours is 8 hour per day so for a week a man must work 56 hours.

Program:

#include <iostream>
using namespace std;

int main() {
float x,wp,gross,total_salary,hour,dep;
float ss,Fi,si,wks;
   // your code goes here
   cout<<"Enter the hours";
   cin>>hour;
   cout<<"enter the dependency";
   cin>>dep;
  
   total_salary=hour*16.78;
   ss=(total_salary*6)/100;
   Fi=(total_salary*14)/100;
   si=(total_salary*5)/100;
   x=Fi+ss+si;
   gross=total_salary - x;
   wks=(hour/56);
   if(wks>0)
   {
   wp=10+wks;;
   gross=total_salary-wp;
   x=x+wp;
   }
   if(dep<=3)
   {
   gross=gross-35;
   x=x+35;
   }   
   cout<<"Take home salary"<<gross;
   cout<<"Withhold amount"<<x;
   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