#include
using namespace std;
int main()
{
double hours;
double rate;
double eh;
double wp;
cout << "Enter total worked hours: ";
cin >> hours;
if (hours < 0.0)
{
cout << "Worked hours cannot be negative. \n\n";
}
else
{
cout << "Enter the rate per hour: ";
cin >> rate;
if (rate < 0.0)
{
cout << "Rate cannot be negative. \n\n";
}
else
{
//If there are more than 40 hours, it will pay the extra hours double.
if (hours > 40.0)
{
eh = hours - 40.0;
wp = 40.0 * rate + eh * rate * 2.0;
}
else
{
wp = hours * rate;
}
cout << "Your payout this week is: $" << wp << "\n\n";
}
}
return 0;
}