1
13k
Guest
Public Class Form1
Const _cdecPricePerRivets As Decimal = 0.31D
Const _cdecPricePerBolts As Decimal = 1.07D
Const _cdecPricePerWashers As Decimal = 0.086D
Const _cdecPricePerNuts As Decimal = 0.97D
Const _cdecPricePerSprings As Decimal = 2.19D
Const _cdecTaxRate As Decimal = 0.08625D
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCalculate Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim strNumberOfRivets As String
Dim strNumberOfBolts As String
Dim strNumberOfWashers As String
Dim strNumberOfNuts As String
Dim strNumberOfSprings As String
Dim intNumberOfRivets As Integer
Dim intNumberOfBolts As Integer
Dim intNumberOfWashers As Integer
Dim intNumberOfNuts As Integer
Dim intNumberOfSprings As Integer
Dim decCostOfRivets As Decimal
Dim decCostOfBolts As Decimal
Dim decCostOfWashers As Decimal
Dim decCostofNuts As Decimal
Dim decCostOfSprings As Decimal
Dim decSubTotal As Decimal
Dim decTaxAmount As Decimal
Dim decTotal As Decimal
strNumberOfRivets = txtNumberOfRivets.Text
intNumberOfRivets = Convert.ToInt32(strNumberOfRivets)
decCostOfRivets = intNumberOfRivets * _cdecPricePerRivets
lblCostOfRivets.Text = decCostOfRivets.ToString("C")
strNumberOfBolts = txtNumberOfBolts.Text
intNumberOfBolts = Convert.ToInt32(strNumberOfBolts)
decCostOfBolts = intNumberOfBolts * _cdecPricePerBolts
lblCostOfBolts.Text = decCostOfBolts.ToString("C")
strNumberOfWashers = txtNumberOfWashers.Text
intNumberOfWashers = Convert.ToInt32(strNumberOfWashers)
decCostOfWashers = intNumberOfWashers * _cdecPricePerWashers
lblCostOfWashers.Text = decCostOfWashers.ToString("C")
strNumberOfNuts = txtNumberOfNuts.Text
intNumberOfNuts = Convert.ToInt32(strNumberOfNuts)
decCostofNuts = intNumberOfWashers * _cdecPricePerNuts
lblCostOfNuts.Text = decCostofNuts.ToString("C")
strNumberOfSprings = txtNumberOfSprings.Text
intNumberOfSprings = Convert.ToInt32(strNumberOfSprings)
decCostOfSprings = intNumberOfSprings * _cdecPricePerSprings
lblCostOfSprings.Text = decCostOfSprings.ToString("C")
decSubTotal = decCostOfRivets + decCostOfBolts + decCostOfWashers + decCostofNuts + decCostOfSprings
decTaxAmount = decSubTotal * _cdecTaxRate
decTotal = decSubTotal + decTaxAmount
lblSubTotal.Text = decSubTotal.ToString("C")
lblTax.Text = decTaxAmount.ToString("C")
lblTotalCostInShoppingCart.Text = decTotal.ToString("C")
lblCostOfRivets.Visible = True
lblCostOfBolts.Visible = True
lblCostOfWashers.Visible = True
lblCostOfNuts.Visible = True
lblCostOfSprings.Visible = True
lblSubTotal.Visible = True
lblTax.Visible = True
lblTotalCostInShoppingCart.Visible = True
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
txtNumberOfRivets.Clear()
txtNumberOfBolts.Clear()
txtNumberOfWashers.Clear()
txtNumberOfNuts.Clear()
txtNumberOfSprings.Clear()
lblCostOfRivets.Text = ""
lblCostOfBolts.Text = ""
lblCostOfWashers.Text = ""
lblCostOfNuts.Text = ""
lblCostOfSprings.Text = ""
txtNumberOfRivets.Focus()
txtNumberOfBolts.Focus()
txtNumberOfWashers.Focus()
txtNumberOfNuts.Focus()
txtNumberOfSprings.Focus()
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
End Class
Continue reading...
Const _cdecPricePerRivets As Decimal = 0.31D
Const _cdecPricePerBolts As Decimal = 1.07D
Const _cdecPricePerWashers As Decimal = 0.086D
Const _cdecPricePerNuts As Decimal = 0.97D
Const _cdecPricePerSprings As Decimal = 2.19D
Const _cdecTaxRate As Decimal = 0.08625D
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCalculate Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim strNumberOfRivets As String
Dim strNumberOfBolts As String
Dim strNumberOfWashers As String
Dim strNumberOfNuts As String
Dim strNumberOfSprings As String
Dim intNumberOfRivets As Integer
Dim intNumberOfBolts As Integer
Dim intNumberOfWashers As Integer
Dim intNumberOfNuts As Integer
Dim intNumberOfSprings As Integer
Dim decCostOfRivets As Decimal
Dim decCostOfBolts As Decimal
Dim decCostOfWashers As Decimal
Dim decCostofNuts As Decimal
Dim decCostOfSprings As Decimal
Dim decSubTotal As Decimal
Dim decTaxAmount As Decimal
Dim decTotal As Decimal
strNumberOfRivets = txtNumberOfRivets.Text
intNumberOfRivets = Convert.ToInt32(strNumberOfRivets)
decCostOfRivets = intNumberOfRivets * _cdecPricePerRivets
lblCostOfRivets.Text = decCostOfRivets.ToString("C")
strNumberOfBolts = txtNumberOfBolts.Text
intNumberOfBolts = Convert.ToInt32(strNumberOfBolts)
decCostOfBolts = intNumberOfBolts * _cdecPricePerBolts
lblCostOfBolts.Text = decCostOfBolts.ToString("C")
strNumberOfWashers = txtNumberOfWashers.Text
intNumberOfWashers = Convert.ToInt32(strNumberOfWashers)
decCostOfWashers = intNumberOfWashers * _cdecPricePerWashers
lblCostOfWashers.Text = decCostOfWashers.ToString("C")
strNumberOfNuts = txtNumberOfNuts.Text
intNumberOfNuts = Convert.ToInt32(strNumberOfNuts)
decCostofNuts = intNumberOfWashers * _cdecPricePerNuts
lblCostOfNuts.Text = decCostofNuts.ToString("C")
strNumberOfSprings = txtNumberOfSprings.Text
intNumberOfSprings = Convert.ToInt32(strNumberOfSprings)
decCostOfSprings = intNumberOfSprings * _cdecPricePerSprings
lblCostOfSprings.Text = decCostOfSprings.ToString("C")
decSubTotal = decCostOfRivets + decCostOfBolts + decCostOfWashers + decCostofNuts + decCostOfSprings
decTaxAmount = decSubTotal * _cdecTaxRate
decTotal = decSubTotal + decTaxAmount
lblSubTotal.Text = decSubTotal.ToString("C")
lblTax.Text = decTaxAmount.ToString("C")
lblTotalCostInShoppingCart.Text = decTotal.ToString("C")
lblCostOfRivets.Visible = True
lblCostOfBolts.Visible = True
lblCostOfWashers.Visible = True
lblCostOfNuts.Visible = True
lblCostOfSprings.Visible = True
lblSubTotal.Visible = True
lblTax.Visible = True
lblTotalCostInShoppingCart.Visible = True
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
txtNumberOfRivets.Clear()
txtNumberOfBolts.Clear()
txtNumberOfWashers.Clear()
txtNumberOfNuts.Clear()
txtNumberOfSprings.Clear()
lblCostOfRivets.Text = ""
lblCostOfBolts.Text = ""
lblCostOfWashers.Text = ""
lblCostOfNuts.Text = ""
lblCostOfSprings.Text = ""
txtNumberOfRivets.Focus()
txtNumberOfBolts.Focus()
txtNumberOfWashers.Focus()
txtNumberOfNuts.Focus()
txtNumberOfSprings.Focus()
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
End Class
Continue reading...