2007-10-04 15:00:52奶茶

水費計算

Private Sub Command1_Click()
a = Val(InputBox(”請輸入用水度數”))
If a <= 20 Then
tot = 100
Else
If a <= 30 Then
tot = 100 + (a - 20) * 3
Else
If a >= 31 And a <= 50 Then
tot = 100 + 10 * 3 + (a - 30) * 4
Else
tot = 100 + 10 * 3 + 20 * 4 + (a - 50) * 6
End If
End If
End If
MsgBox (”水費總計” & tot & ”元”)
End Sub