if statement not working

I'm trying to calculate gross pay with a simple hours worked * hourly wage. If the user has worked more than 40 hours the user should get time and a half on only the over time hours. For example if i worked 45 hours at $20/hr my gross pay should be $950...problem being my program won't jump to to the 'else' in my if statement. When hours worked = 45 & hourly wage = 20...gross pay still only equals $900.00

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//function prototypes
void getInput(int&, double&, double&);	// Gets user input
double computeGrossWage(double, double); // Calculates gross pay based on hours worked & hourly wage

//main program
int main()
{
//variables
  double hoursWorked;
  double hourlyWage;
  double grossPay;

//function calls
getInput(employeeIDnumber, hoursWorked, hourlyWage);
grossPay = computeGrossWage(hoursWorked, hourlyWage);
computeGrossWage(hoursWorked, hourlyWage);	

	
cout <<fixed <<setprecision(2)<<grossPay<< endl;

//Function definition
void getInput(int& employeeIDnumber, double& hoursWorked, double& hourlyWage)
	{
		cout << "Enter employee ID number: ";
		cin >> employeeIDnumber;

		cout << "Enter number of hours worked: ";
		cin >> hoursWorked;

		cout << "Enter hourly wage: ";
		cin >> hourlyWage;
	}
double computeGrossWage(double hourlyWage, double hoursWorked)
	{
		double grossPay;	
		if (hoursWorked <= 40)
	grossPay = (hoursWorked * hourlyWage);
		else 
	grossPay = (hourlyWage * (hoursWorked - 40) * 1.5) + (40 * hourlyWage); 
		return grossPay;
	}
Last edited on
my assignments were reversed in the function definition =_="
Topic archived. No new replies allowed.