The problem goes as follows: Get hourly pay rate & # of hours from the user, compute & output the weekly pay, but do not pay for the extra hours beyond 50. Also, for the overtime hours, (hours beyond regular 40 hours), pay at 1.5 times regular rate.
I have everything coded, but when the user inputs 57 hours my code will not limit to only consider 10 hours as overtime instead it calculates 17 as overtime. I need to limit the number, but I don't know to the write the necessary syntax to do so.
cout << "Your weekly pay: " << (payRate * 40) + 1.5 * payRate * (hours - 40) ;
else
cout << "Your weekly pay: " << payRate * hours;```
Aucun commentaire:
Enregistrer un commentaire