我試圖根據一個人的年齡類別和髮廊的訪問量來計算折扣。這只是不正常工作。它不計算正確的折扣,直到第二次點擊,然後它做了一些奇怪的東西,如果我繼續按計算。只是想知道我哪裏錯了,謝謝。在VB.NET中計算折扣
' Discount
If radAdult.Checked = True Then
discount = 0
ElseIf radChild.Checked = True Then
discount = totalPrice * 0.1
ElseIf radStudent.Checked = True Then
discount = totalPrice * 0.05
ElseIf radSenior.Checked = True Then
discount = totalPrice * 0.15
End If
' Additional discount
If txtClientVisits.Text >= 1 And txtClientVisits.Text <= 3 Then
additionalDiscount = 0
ElseIf txtClientVisits.Text >= 4 And txtClientVisits.Text <= 8 Then
additionalDiscount = totalPrice * 0.05
ElseIf txtClientVisits.Text >= 9 And txtClientVisits.Text <= 13 Then
additionalDiscount = totalPrice * 0.1
ElseIf txtClientVisits.Text >= 14 Then
additionalDiscount = totalPrice * 0.15
End If
totalPrice = baseRate + serviceRate - (discount + additionalDiscount)
你沒有張貼的所有代碼。你可以發佈**哪裏**它不能正確計算? –
開關選項嚴格要求 –