Question #10845

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 times 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, and $10 per week is withheld for union dues. Write a C++ program manipulate the above scenario

Expert's answer

//& Defines the entry point for the console application.

//

//#include "stdafx.h"

#include "iostream"

using namespace std;

const double SALARY = 16.78;

const int WORK_DAY_ON_WEEK = 5;

void calculate( double hoursperday, double overhoursperday )

{

double result, salary;

salary = ( ( ( SALARY * hoursperday ) + ( overhoursperday * 1.5 * SALARY ) ) * WORK_DAY_ON_WEEK ) ;

result = salary - (salary*0.06 + salary*0.14 + salary*0.05 + 10);

cout<<" your final salary is "<<result<<"$"<<endl;

}

int main()

{

double hours_per_day;

cout<<" Enter plz how many hour per day worker works "<<endl;

cin>>hours_per_day;

double over_hours_per_day;

cout<<" Enter plz how many hour over time worker works "<<endl;

cin>>over_hours_per_day;

calculate( hours_per_day, over_hours_per_day );

return 0;

}

//

//#include "stdafx.h"

#include "iostream"

using namespace std;

const double SALARY = 16.78;

const int WORK_DAY_ON_WEEK = 5;

void calculate( double hoursperday, double overhoursperday )

{

double result, salary;

salary = ( ( ( SALARY * hoursperday ) + ( overhoursperday * 1.5 * SALARY ) ) * WORK_DAY_ON_WEEK ) ;

result = salary - (salary*0.06 + salary*0.14 + salary*0.05 + 10);

cout<<" your final salary is "<<result<<"$"<<endl;

}

int main()

{

double hours_per_day;

cout<<" Enter plz how many hour per day worker works "<<endl;

cin>>hours_per_day;

double over_hours_per_day;

cout<<" Enter plz how many hour over time worker works "<<endl;

cin>>over_hours_per_day;

calculate( hours_per_day, over_hours_per_day );

return 0;

}

## Comments

## Leave a comment