我一直收到这个烦人的错误。我不知道为什么它会不断弹出。我试图重新安排一切。我用Swift编写了它,它起作用了。我试图用Dim MTI as Currency, ATI as Currency
声明变量,就像在另一个question中所建议的那样,所以这是我最后的希望
完整的源代码:
Function ST(salary As Currency, pensioner As Boolean, year As Integer) As Currency
Dim k As Integer
Dim MTI, SP, ATI, AAST As Currency
k = 12
MTI = MTI(salary, pensioner)
SP = SP(MTI, pensioner)
ATI = MTI * k
AAST = AAST(ATI) //Error here (Compile error: expected array)
If year >= 2008 & year <= 2013 Then
ST = AAST / k - SP
ElseIf year < 2008 Then
ST = MTI * 0.21
ElseIf year > 2013 Then
ST = MTI * 0.11 - SP
End If
End Function
Function MTI(salary As Currency, pensioner As Boolean) As Currency
If pensioner = False Then
MTI = salary
ElseIf pensioner = True Then
MTI = salary * (0.9)
End If
End Function
Function SP(MTI As Currency, pensioner As Boolean) As Currency
Dim MW As Currency
MW = 9752
If pensioner = True Then
SP = 0
ElseIf pensioner = False Then
If MTI >= 10 * MW Then
SP = 10 * MW * 0.03
ElseIf MTI < 10 * MW Then
SP = MTI * 0.03
End If
End If
End Function
Function AAST(income As Currency) As Currency
If income <= 196560 Then
AAST = income * 0.2
ElseIf income <= 524160 Then
AAST = (income - 196560) * 0.15 + AAST(196560)
ElseIf income <= 2620800 Then
AAST = (income - 524160) * 0.12 + AAST(524160)
ElseIf income <= 7862400 Then
AAST = (income - 2620800) * 0.09 + AAST(2620800)
ElseIf income > 7862400 Then
AAST = (income - 7862400) * 0.07 + AAST(7862400)
End If
End Function