Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- const int STD_HRS = 40;
- const float OVERTIME_MULT = 1.5;
- int main()
- {
- cout << setprecision(2);
- 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) * OVERTIME_MULT;
- }
- float pay;
- pay = regular + overtime;
- cout << "Pay: $" << pay << endl;
- return 0;
- }
- OUTPUT:
- Enter hours worked: 40
- Enter rate: 8
- Pay: $320.00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement