Answer to Question #270139 in C++ for Princess faith

Question #270139

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



Display the basic salary, bonus and the total salary (basic salary + bonus) for the week.

1
Expert's answer
2021-11-23T05:24:17-0500
#include <iostream>


using namespace std;


int main()
{
    int hours,hrate;
    float bsalary,tsalary,bonus;
    cout<<"Enter the number of hours worked and hourly rate:"<<endl;
    cin>>hours>>hrate;
    bsalary=hours*hrate;
    if(hours>35 && hours<=40)
        {
        bonus=150;
        }
    else if(hours>40 && hours<=45)
    {
        bonus=250;
    }
    else if(hours>45)
    {
        bonus=500;
    }
    tsalary=bonus+bsalary;
    cout<<"The amount in pesos"<<endl;
    cout<<"basic salary"<<"\t\t"<<"bonus"<<"\t\t"<<"Total Salary"<<endl;
    cout<<bsalary<<"\t\t\t"<<bonus<<"\t\t"<<tsalary;
    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