I set up my program to run based off the employee putting in what the time worked for each week for 5 weeks but I'm having trouble figuring out how to calculate the overtime on the hours worked as a whole (anything over 200 hours) but now realize that's not right, it should be on each week? Either way, I can't get the overtime rate to work.
Whether you calculate overtime weekly or every 5 weeks will not change the outcome. I'd find it more efficient to do the calculation after you have the data for all 5 weeks, as then you will only need to do a single calculation rather than 5 separate ones. To start, I'd place those calculations in the calcPay() function, rather than the getHours() function. Also, your calculations are incorrect; You don't want to calculate overtime if you work more than 200 hours every week, as there are only 168 hours in a week! The conditions that you are checking for are also incorrect, take a look at those. Remember that in the end, you'll want to calculate the overtime pay and add it to the non-overtime pay. Think about these things, and let me know if you need any help. I have a solution completed, but I'd rather not release it unless you are 100% stuck.
After spending a few hours on this. I thought I figured out how to incorporate the overtime and fixed the bugs along the way but now when I run the program it doesn't calculate the gross pay, withholding or net pay anymore. This is what I did...
float getHours()
{
int counter;
float hours, sum=0;
for (counter=1; counter <=5; counter++)
{
cout<<"Enter the number of hours worked for Week "<<counter<<":"<<" ";
cin>> hours;
sum += hours;
}
return sum;
}