I was given a program that used double functions to calculate overtime pay. Hours 1 to 37 gets paid their standard rate. Hours 38 to 50 gets paid time and a half. Hours over 50 get paid double their rate. The only thing I have to do is do all of the calculations I have already done, but use a void function instead of a double function. The problem is that every time I try to, I get an error that says you can't use a double in a void function. Here is the code:
It's not clear from the code posted what changes were made to make the function void. If extraPay is no longer returned from the function at line 48, did you add it to the function parameters?
So, I actually looked at some code I wrote earlier regarding the temperature, and I re-formatted the code to do this. It actually works. It's kind of embarrassing that I have asked for help twice now and figured it out immediately after I posted. I apologize.
To give you some ideas,
Line 6: double getOvertime(double hours, double rate); , could be: void getOvertime(double hours, double rate, double extraPay);
Line 27: overtime = getOvertime(hoursWkd, payRate);, could be: getOvertime(hoursWkd, payRate, overtime);