All pastes #755354 Raw Edit

Stuff

public text v1 · immutable
#755354 ·published 2007-10-30 17:25 UTC
rendered paste body
' Project Name: Ice Cream Order Calculator

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'clears the textboxes
        totalTextBox.Clear()
        sumTextBox.Clear()
        taxTextBox.Clear()

        'clears the checkboxes
        sprinkCheckBox.Checked = False
        fudgeCheckBox.Checked = False
        cherryCheckBox.Checked = False

        'resets the radiobutton back to the top of the list
        chocRadioButton.Checked = True
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '       dim variables for information to be stored in
        Dim price As Integer
        Dim sprinkles As Integer
        Dim fudge As Integer
        Dim cherries As Integer
        Dim subtotal As Integer
        Dim tax As Integer
        Dim grandtotal As Integer

        ' determines which radio button is selected, then adds the selected price
        ' to the "price" variable
        If chocRadioButton.Checked Then
            price = 1.5
        ElseIf vanRadioButton.Checked Then
            price = 1.0
        ElseIf swirlRadioButton.Checked Then
            price = 1.25
        End If

        ' determines if sprinkles are checked, if they are .25 is added to the variable
        ' if they are not, then 0 is added to the variable
        If sprinkCheckBox.Checked Then
            sprinkles = 0.25
        Else : sprinkles = 0
        End If

        ' determines if fudge is checked, if it is .75 is added to the variable
        ' if it is not, then 0 is added to the variable
        If fudgeCheckBox.Checked Then
            fudge = 0.75
        Else : fudge = 0
        End If

        ' determines if cherries are checked, if they are .55 is added to the variable
        ' if they are not, then 0 is added to the variable
        If cherryCheckBox.Checked Then
            cherries = 0.55
        Else : cherries = 0
        End If

        'calculate price for sub-total box
        subtotal = (price + sprinkles + fudge + cherries)

        'calculate tax for tax box
        tax = (subtotal * 0.08)

        'calculate grand total
        grandtotal = (subtotal + tax)

        'display calculated results
        sumTextBox.Text = Convert.ToString(subtotal)
        taxTextBox.Text = Convert.ToString(tax)
        totalTextBox.Text = Convert.ToString(grandtotal)

    End Sub
End Class