Adding Overtime Pay

后端 未结 2 804
慢半拍i
慢半拍i 2021-01-28 08:14

the program works, but i\'m not sure how to get the grosspay to add the overtime pay once the if condition is set, I was told to set overtime pay to zero on the declaration. Is

2条回答
  •  庸人自扰
    2021-01-28 08:58

    You need to calculate the overtime pay first, before outputting the gross pay:

    if(hw > 40)
        OvertimePay = (hw - 40) * hp * 0.5;
    
    gp = hw * hp + OvertimePay;
    

提交回复
热议问题