我的 CalcPay 方法没有正确计算加班时间,任何人都可以看到任何会导致这种情况的明显问题吗?
private const double FED_TAX = 0.2;
private const int FULL_TIME = 40;
private const double OVER_TIME = 1.5;
private const double STATE_TAX = 0.075;
public double CalcPay()
{
double pay = hoursWorked * hourlyWage;
double overTimeHors = hoursWorked - FULL_TIME;
if (overTimeHours > 0)
{
pay = overTimeHors * (hourlyWage * OVER_TIME);
}
double tax1 = pay * FED_TAX;
double tax2 = pay * STATE_TAX;
return ((pay - tax1) - tax2);
}