I'm making a program to compute hourly pay. If you work less than or equal to 40 hours your pay = 12 per hour. Every hour after 40 hours you earn $17 dollars an hour. My program keeps running the else statement even though they are false. Any help is appreciated, here is my code
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double hOurs, pAy;
cout << "How many hours have you worked this week?: ";
cin >> hOurs;
if (hOurs <= 40)
{pAy = hOurs*12.0;
cout << "Your weekly pay is $" << pAy << ".";}
What you're trying to say is that if hours worked is less than 40, calculate pay like this, else calculate your pay like this. You don't need a condition for the else because you either worked 40 hours or you didn't. Change your if statement to: