The document describes a Visual Basic lesson example for calculating sales data. It includes:
- An app that takes a list of weekly sales from the user and calculates the total sales, 2% of total sales, 5% of total sales, lowest weekly sale, and highest weekly sale.
- The user interface allows the user to enter weekly sales data.
- The main code has buttons to calculate 2% tax on total sales, 5% tax on total sales, and exit. It also calculates the running total, minimum, and maximum sales on each input.
The document describes a Visual Basic lesson example for calculating sales data. It includes:
- An app that takes a list of weekly sales from the user and calculates the total sales, 2% of total sales, 5% of total sales, lowest weekly sale, and highest weekly sale.
- The user interface allows the user to enter weekly sales data.
- The main code has buttons to calculate 2% tax on total sales, 5% tax on total sales, and exit. It also calculates the running total, minimum, and maximum sales on each input.
The document describes a Visual Basic lesson example for calculating sales data. It includes:
- An app that takes a list of weekly sales from the user and calculates the total sales, 2% of total sales, 5% of total sales, lowest weekly sale, and highest weekly sale.
- The user interface allows the user to enter weekly sales data.
- The main code has buttons to calculate 2% tax on total sales, 5% tax on total sales, and exit. It also calculates the running total, minimum, and maximum sales on each input.
Main Code (1/3) Public Class VariablesDT Private sale As Double Private Sub btnTax2_Click(sender As Object, e As EventArgs) Handles btnTax2.Click 'Dim sale As Double Dim tax2 As Double Dim totalsalestring As String totalsalestring = txtTotalSales.Text.Remove(0, 4) Double.TryParse(totalsalestring, sale) tax2 = 0.02 * sale txtTax.Text = tax2.ToString("c2") For x As Integer = 0 To 10 Dim tp As Double Next End Sub
Main Code (2/3) Private Sub btnTax5_Click(sender As Object, e As EventArgs) Handles btnTax5.Click Dim tax5 As Double Double.TryParse(txtTotalSales.Text.Remove(0, 4), sale) tax5 = 0.05 * sale txtTax.Text = tax5.ToString("C2") End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles
Private Sub btnSale_Click(sender As Object, e As EventArgs) Handles btnSale.Click Main Lesson Problem Static TotalSales As Double Double.TryParse(txtSale.Text, sale) TotalSales += sale txtTotalSales.Text = TotalSales.ToString("C2") Static min, max, saleCount As Integer saleCount += 1 If saleCount <= 1 Then min = sale max = sale Else If sale > max Then max = sale ElseIf sale < min Then min = sale End If End If txtMax.Text = max.ToString("C2") txtMin.Text = min.ToString("C2") End Sub 6 End Class