Answer to Question #269949 in C++ for Bem

Question #269949

Make a program that asks the user for the hours worked for the week and the hourly rate. The basic salary is computed as:



Salary = hours worked*hourly rate



Bonuses are given:


-No. of hours > 45


~No of hours > 40 and <= 45


✓No of hours > 35 and <= 40



-Bonus of 500 pesos


~Bonus of 250 pesos


✓Bonus of 150 pesos

1
Expert's answer
2021-11-22T07:08:59-0500


SOLUTION CODE


#include <iostream>
using namespace std;


int main() {
//e user for the hours worked for the week and the hourly rate.
cout<<"Enter the hours worked for the week: ";
int hours_worked;
cin>>hours_worked;
cout<<"Enter the hourly rate: ";
int hourly_rate;
cin>>hourly_rate;


double salary = hours_worked*hourly_rate;


double bonus;


if(hours_worked>45)
{
	cout<<"Hours worked = "<<hours_worked<<endl;
	cout<<"Hourly rate = "<<hourly_rate<<endl;
	cout<<"Salary = "<<salary+500.0<<" pesos"<<endl;	
}
else if(hours_worked >40 && hours_worked <= 45)
{
	cout<<"Hours worked = "<<hours_worked<<endl;
	cout<<"Hourly rate = "<<hourly_rate<<endl;
	cout<<"Salary = "<<salary+250.0<<" pesos"<<endl;	
}
else if(hours_worked > 35 && hours_worked <= 40)
{
	cout<<"Hours worked = "<<hours_worked<<endl;
	cout<<"Hourly rate = "<<hourly_rate<<endl;
	cout<<"Salary = "<<salary+150.0<<" pesos"<<endl;	
}
else
{


	cout<<"Hours worked = "<<hours_worked<<endl;
	cout<<"Hourly rate = "<<hourly_rate<<endl;
	cout<<"Salary = "<<salary<<" pesos"<<endl;	


}


    
    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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS