Write a c++ program that will compute the gross pay of the employee after 5 days work. The gross pay is the number of hours work per day plus the bonus pay after it reach the 5 day quota, see below table. The employee is paid 100 pesos per hour
The Bonus is computed in percentage of the total salary the employee earn.
At the end of the program it will ask the user to run the program again or terminate. If to run, it will loop from the beginning of the program.
Total Hours Work Bonus Percentage
Below 40 Hours 0
40-55 Hours + 5%
56-65 + 10%
65 above + 15%
Total Salary = Total Number of Hours work x 100
Gross Pay = Total Salary + Bonus
Sample:
>>Hours work day 1: 8
>>Hours work day 2: 9
>>Hours work day 3: 10.5
>>Hours work day 4: 5
>>Hours work day 5: 10
>> Your gross pay for the week is 4462.5
>> Do you want to continue? Y if Yes or press other key to exit: h
>>
#include <iostream>
using namespace std;
int main()
{
float d1,d2,d3,d4,d5,hrs,totalSaly,bonus,gropay;
char ch, Y;
cout<<"\t\t**********A program to compute the grosspay after 5 days work*********"<<endl;
ch=Y;
while(ch='Y')
{
cout<<"Enter hours work per day: "<<endl;
cout<<"Hours Work Day1:";
cin>>d1;
cout<<"Hours Work Day2:";
cin>>d2;
cout<<"Hours Work Day3:";
cin>>d3;
cout<<"Hours Work Day4:";
cin>>d4;
cout<<"Hours Work Day5:";
cin>>d5;
hrs=d1+d2+d3+d4+d5;
totalSaly=hrs*100;
if(hrs<40)
{
bonus=0;
}
else if(hrs>=40 && hrs<=45)
{
bonus= totalSaly*0.05;
}
else if(hrs>=56 && hrs<=65)
{
bonus= totalSaly*0.1;
}
else if(hrs>65)
{
bonus= totalSaly*1.5;
}
gropay= totalSaly + bonus;
cout<<"Your gross pay for the week is: "<<gropay<<endl;
cout<<"Do you want to continue? Y if Yes or press other key to exit";
cin>>ch;
}
}
Comments
Leave a comment