0

我不处理VB。我正在帮我妈妈做作业,我不能再想清楚该怎么处理这个陈述了。

Private Sub btnTotal_Click(sender As Object, e As EventArgs) Handles btnTotal.Click
    Dim intPackA As Integer = 0
    Dim intPackB As Integer = 0
    Dim intPackC As Integer = 0
    Dim SavingsPriceB As Decimal = 0.0
    Dim SavingsPriceC As Decimal = 0.0
    Dim TotalPrice As Decimal = 0.0
    lblTotal.Text = String.Empty

If radPackA.Checked Then
    TotalPrice = 9.95
    lblTotal.Text = TotalPrice
    If Integer.TryParse(txtHours.Text, intPackA) Then
        If intPackA > 10 Then
            TotalPrice = TotalPrice + ((intPackA - 10) * 2)
            lblTotal.Text = TotalPrice
        End If
    End If
    If chkSavings.Checked Then
        SavingsPriceB = 14.95 + ((intPackB - 20) * 1)
        SavingsPriceC = 19.95
        If TotalPrice < SavingsPriceB And TotalPrice < SavingsPriceC Then
            lblTotal.Text = TotalPrice & ", no savings with Package B or C"
        End If
    End If
ElseIf radPackB.Checked Then
    TotalPrice = 14.95
    lblTotal.Text = TotalPrice
    If Integer.TryParse(txtHours.Text, intPackB) Then
        If intPackB > 20 Then
            TotalPrice = TotalPrice + ((intPackB - 20) * 1)
            lblTotal.Text = TotalPrice
        End If
    End If
    If chkSavings.Checked Then
        
    End If
ElseIf radPackC.Checked Then
    TotalPrice = 19.95
    lblTotal.Text = TotalPrice
End If

If chkNonprofit.Checked Then
    TotalPrice = Format((TotalPrice - ((TotalPrice / 100) * 20)), ".00")
    lblTotal.Text = TotalPrice & ControlChars.CrLf & "Non-Profit Organization discount applied"
End If
End Sub

这是If chkSavings.Checked给我的问题。

这是设计的程序。包裹下方有一个标签,显示总数。 在此处输入图像描述

Potential Savings选中后,它还应该显示如果您使用不同的包裹可以节省的金额。

所以如果我把Package A, 5 hours, 20% discount它应该说$7.96, no savings with Package B or C。因为Package A, 25 hours它应该说$39.95, save $20.00 with Package B, and save $20.00 with Package C

我拥有的代码即使是第一部分也没有打印出来。

Package A and less then 10 hours = $9.95, every additional hour is $2.00 more Package B and less then 20 hours = $14.95, every additional hour is $1.00 more Package C with unlimited hours is = $19.95

所以我的问题是,我在我的代码中做错了什么,或者我怎样才能实现我正在寻找的东西。

4

0 回答 0