Pay Of Over Time:-
#include <iostream>
using namespace std;
int main()
{
const float OVERTIME_MULT = 1.5;
cout << fixed << showpoint;
float hours, rate;
cout << "Enter hours worked: ";
cin >> hours;
cout << "Enter rate: ";
cin >> rate;
float regular, overtime;
if ( hours <= STD_HRS )
{
regular
= hours * rate;
overtime = 0.0;
}
else
{
regular
= STD_HRS * rate;
overtime = (hours - STD_HRS) * rate *
OVERTIME_MULT;
}
float pay;
pay = regular + overtime;
cout << "Pay: $" << pay << endl;
return 0;
Comments
Post a Comment