-1
我正在編寫一個程序來計算網絡費用。三種套餐,A,B和C可供選擇,價格爲9.95美元(10小時;每小時2美元),14.95美元(15小時; 1美元/小時額外)和19.95美元(無限制)。結合複選框和單選按鈕,視覺基本
這裏是我寫的掩碼文本框輸入的代碼(只有一種情況)。我想簡化使用複選框和單選按鈕,但我從來沒有使用過。任何提示或提示?
Case "A"
If hours < 10 And nonprofit.ToUpper = "Y" Then
lstOutput.Items.Add("Total Cost is " & FormatCurrency(9.95 * 0.8))
'package A with nonprofit status, under limit
ElseIf hours < 10 And nonprofit.ToUpper = "N" Then
lstOutput.Items.Add("Total Cost is " & FormatCurrency(9.95))
'package A without nonprofit status, under limit
ElseIf hours > 10 And nonprofit.ToUpper = "Y" Then
lstOutput.Items.Add("Total Cost is " & FormatCurrency((9.95 + _
(hours - 10) * 2) * 0.8))
'package A with nonprofit status, over limit
ElseIf hours > 10 And nonprofit.ToUpper = "N" Then
lstOutput.Items.Add("Total Cost is " & FormatCurrency(9.95 + _
(hours - 10) * 2))
'package A without nonprofit status, over limit
End If