Problem :

The " I can't believe it's true " movie company is looking for extras to be in their new movie.your job is to write a program that calculates the total pay due to an extra based on the number of hours they are needed on the set. the pay is calculated using the fallowing rules. there is base rate of $1000 plus an hourly rate of $20 for someone working less that 8 hours, an hourly rate $25 dollars for someone acting from 8 to 15 hours,an hourly rate of $37 for someone working 16 to 30 hours and $ 45 an hour for those working for more than 30 hours.use the conditional operator

ask the user to input the number of hours they have worked.

write the output in the following format:

you have worked X hours and your total pay is $ yyy.yy

Solve:

Code:

#include<iostream>
int main ()
{
float totalpay;
int hours;
cout<<"Enter the number of hours you worked:";
cin>>hours;
if(hours < 8)
totalpay=hours*20+1000;
else if (hours >= 8 && hours <= 15)
totalpay=hours*25+1000;
else if (hours >=16 && hours <= 30)
totalpay=hours*37+1000;
else if (hours > 30)
totalpay=hours*45+1000;
cout<<"\nYou have worked "<<hours<<" hours and your total pay is "<<totalpay<<" dollars"<<endl;
cin >> hours;
return 0 ;
}

**Mansur**