1. ## Wages Calculation Program

Code:
```#include<iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{

int hoursWorked;
double hourlyWage;
double salary;
double overtime;

do {

cout << "\nEnter hours worked (-1 to End): ";
cin >> hoursWorked;

if (hoursWorked == -1)
break;

cout << "Enter the employees hourly wage: ";
cin >> hourlyWage;

if (hoursWorked>40){
overtime = (hoursWorked-40)*1.5;
salary = ((hourlyWage * hoursWorked) + (overtime * hourlyWage));
}
else
salary = (hourlyWage*hoursWorked);

cout << "Salary is: " << salary;

} while (hoursWorked != -1);

return 0;
}```
The program needs to calculate any hours worked over 40 as overtime (time and a half), for example 1 hour over time = 1.5 hours * hourlywage. 2 hours overtime = 3 hours * hourlywage, 3 hours overtime = 4.5 hours * hourlywage. This only applies to any hours worked OVER 40. If the total hours is 40 or below, the wage is payed at the usual hourly rate = hourlywage * hoursworked.

Should output:
----------------
Enter Hours Worked (-1 to End) : 39
Enter the employees hourly wage: 10
Salary is 390

Enter hours worked (-1 to end): 41
Enter the employees hourly wage: 10
Salary is 415

Outputs:
---------------
Enter hours worked (-1 to End): 39
Enter the employees hourly wage: 10
Salary is: 390
Enter hours worked (-1 to End): 41
Enter the employees hourly wage: 10
Salary is: 425

Why do I get 425 instead of 415, as shown above?

2. According to your code it is suppose to give 425(410+15)

3. try:
Code:
```if (hoursWorked>40){
overtime = (hoursWorked-40)*1.5;
hoursWorked = 40; // need to set this here,
salary = ((hourlyWage * hoursWorked) + (overtime * hourlyWage));
}```