#include #include using namespace std; const int REGULAR_HOURS {40}; int main() { float hoursWorked{0}, hourlyRate{0}, regularPay{0}, overtimePay{0}, totalPay{0}; bool paidForOvertime{true}; char answer; cout << "Enter your hourly rate of pay => "; cin >> hourlyRate; cout << endl; cout << "Enter the hours you worked this week => "; cin >> hoursWorked; cout << endl; cout << "Are you paid overtime for more than " << REGULAR_HOURS << " hours a week? (y/n) => "; cin >> answer; cout << endl; if ('n' == answer or 'N' == answer) { paidForOvertime = false; } regularPay = hourlyRate * hoursWorked; if (hoursWorked > REGULAR_HOURS and paidForOvertime) { overtimePay = hourlyRate * 0.5 * (hoursWorked - REGULAR_HOURS) ; } totalPay = regularPay + overtimePay; cout << fixed << setprecision(2); cout << "A person working " << hoursWorked << " hours at $" << hourlyRate; if (not paidForOvertime) { cout << " not "; } cout << " paid for overtime will be paid:" << endl; cout << "\t$" << setw(8) << regularPay << " regular pay" << endl; cout << "\t$" << setw(8) << overtimePay << " overtime pay" << endl; cout << "\t$" << setw(8) << totalPay << " total pay " << endl; cout << endl; return 0; }