Hi I need to make a function that will compute a gross pay for. the problem is I need to make it pay double after 40 hours which is where im getting confused. so far I have something like
double grosspay(double hrate, int hrs){
pay= hrate*hrs;
if (hrs>=40)
pay=.
this is where i get confused. do i need to make a counter for the hours after 40? im thinking a for loop of some kind?
will this only double the hours after 40? or the whole number if its over 40? because only the hours after 40 get double. for instance 50 hrs. the first 40 would be normal
double grosspay(double hrate, int hrs) {
double pay = hrate*hrs ;
// We've already paid the regular hourly rate
// for the overtime hours. If we pay it again
// for (just) the overtime hours, we're golden.
if ( hrs > 40 )
pay += hrate*(hrs-40) ;
return pay ;
}