' Project: Simple Calculation ' Programmer: Andy McCone ' Date: Oct 5th 2007 'Description: This project multiplies Price * Quantity ' Returns the Subtotal, Tax and Total Public Class mainForm Const TAX_RATE_decimal As Decimal = 0.0925 Private Sub calculateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calculateButton.Click 'Create variables Dim priceDecimal As Decimal Dim quantityInteger As Integer Dim subTotalDecimal As Decimal Dim taxDecimal As Decimal Dim totalDecimal As Decimal 'Capture the values in the textboxes priceDecimal = CDec(priceTextbox.Text) quantityInteger = CInt(quantityTextbox.Text) 'Calculate Subtotal and Tax subTotalDecimal = priceDecimal * quantityInteger taxDecimal = subTotalDecimal * TAX_RATE_decimal 'Calculate Total totalDecimal = subTotalDecimal + taxDecimal 'Display the results subtotalLabel.Text = CStr(subTotalDecimal) taxLabel.Text = CStr(taxDecimal) totalLabel.Text = CStr(totalDecimal) End Sub End Class