A nested if inside the switch
here's the code(roughly of course), wondered if it can be done:
Code:
Case ‘2’:
/*Find hourly workers salary */
Printf “Please enter hours worked”
Scanf(%d, &hours)
Printf (“Please enter hourly wage”)
scanF(%d, &wage)
If(hours <= 40){
Salary_2= hours * wage
}
If(Hours > 40 ){
Salary_2 hours * wage + hours> 40 *wage * 1.5{
}
Printf(“The employee’s pay is : %d” , salary_2)
That's the gist of it, is it legal? and of not, maybe someone can suggest something. I also have a hunch the calculation for hours > 40 is wrong if anyone can tell me what that is I'd really appreciate it - math just aint working for me today :)
Thanks, everyone here is a big help.
Regards,
Extro