冰淇淋店计算

时间:2015-01-14 00:42:07

标签: vb.net

过去几天我一直在研究这个项目,我差不多完成了它。我遇到了两个问题,无论我做什么,我无法解决它们。首先是计算是不正确的,例如当我选择一种成本为0.75的2种浇头和坚果时,总量应该达到3.60,但它会达到2.10。我很确定问题与嵌套的if语句有关,但我不知道在哪里。感谢您提供的任何帮助

            If lstFlavourChoices.SelectedIndex = -1 Then
                MsgBox("You need to select a flavour from the list.")
            Else

                If lstFlavourChoices.SelectedIndex >= 2 Then
                    totalDue = totalDue + txtNumberOfScoops.Text * specialFlavours
                Else

                    totalDue = totalDue + txtNumberOfScoops.Text * standardFlavours

                    If chkNuts.Checked = True Then
                        totalDue = totalDue + 0.6
                        If chkWhippedCream.Checked = True Then
                            totalDue = totalDue + 0.8

                            If optNoToppings.Checked = True Then 'these statements will check to ensure the user has selected
                                totalDue = totalDue
                            ElseIf optOneTopping.Checked = True Then
                                totalDue = totalDue + COST_OF_TOPPING
                            ElseIf optTwoToppings.Checked = True Then
                                totalDue = totalDue + COST_OF_TOPPING * 2
                            ElseIf optThreeToppings.Checked = True Then
                                totalDue = totalDue + COST_OF_TOPPING * 3
                            Else
                                MsgBox("You must select a number of toppings")

                            End If
                        End If
                    End If
                End If
            End If
                    End If
                End If



    lblTotalDue.Text = FormatCurrency(totalDue)

0 个答案:

没有答案