' Project: Variables and Constants ' Programmer: Andy McCone ' Date: Jan 18th 2008 'Description: This program takes the price and quantity of a ' sales to give us the subtotal, tax and total ' using local variables Public Class mainForm Dim m_numSalesCounterInteger As Integer Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click 'Declare Variables Dim quantityInteger As Integer Dim priceDecimal As Decimal Dim subTotalDecimal As Decimal Dim taxDecimal, totalDecimal As Decimal 'Capture values in textboxes quantityInteger = Integer.Parse(quantityTextBox.Text) priceDecimal = Decimal.Parse(priceTextBox.Text) 'Calculate the subtotal and tax subTotalDecimal = quantityInteger * priceDecimal taxDecimal = subTotalDecimal * 0.085D 'Calculate Total totalDecimal = subTotalDecimal + taxDecimal 'Display results taxLabel.Text = FormatCurrency(taxDecimal) totalLabel.Text = FormatCurrency(totalDecimal) 'Count the number of sales and display m_numSalesCounterInteger = m_numSalesCounterInteger + 1 numSalesLabel.Text = FormatNumber(m_numSalesCounterInteger, 0) End Sub End Class