当我编译它时,它不断给出错误“此方法必须返回双精度类型的结果”,但我相信我的工资是双倍的。什么地方出了错?..................................
public double getNetPay (int totalHoursWorked)
{
int basePayRate = 15;
double overTime = 15*1.5;
double taxRate1 = 0.25;
double taxRate2 = 0.21;
double taxRate3 = 0.15;
if (totalHoursWorked > 40)
{
double pay =totalHoursWorked*overTime;
if (pay > 1200)
{
return pay*taxRate1;
}
if (pay >=500||pay <1199)
{
return pay*taxRate2;
}
if (pay <=499)
{
return pay*taxRate3;
}
}
else
{
double pay =totalHoursWorked*basePayRate;
if (pay > 1200)
{
return pay*taxRate1;
}
if (pay >=500||pay <1199)
{
return pay*taxRate2;
}
if (pay <=499)
{
return pay*taxRate3;
}
}
}