0% found this document useful (0 votes)
3 views2 pages

Sales Tax Calculator Code Example

The document is a Visual Basic code for a sales transaction form that calculates subtotal, sales tax, grand total, and accumulated totals. It includes error handling for input validation and provides functionality to clear fields and exit the application. The code also tracks the number of transactions to calculate the average sale amount.

Uploaded by

Original Yahuza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Sales Tax Calculator Code Example

The document is a Visual Basic code for a sales transaction form that calculates subtotal, sales tax, grand total, and accumulated totals. It includes error handling for input validation and provides functionality to clear fields and exit the application. The code also tracks the number of transactions to calculate the average sale amount.

Uploaded by

Original Yahuza
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Dim accumulatedTotal As Decimal

Dim accumulatedSalesTax As Decimal


Dim totalTransaction As Integer
Dim balance As Decimal

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles [Link]

End Sub

Private Sub Label1_Click(sender As Object, e As EventArgs) Handles [Link]

End Sub

Private Sub CalculteButton_Click(sender As Object, e As EventArgs) Handles


[Link]

Dim quantityInteger As Integer


Dim price As Decimal
Dim subTotal As Decimal
Dim salesTax As Decimal
Dim salesTaxRate As Decimal = 0.7D
Dim grandTotal As Decimal
Dim amountPaid As Decimal
Dim balance As Decimal
Try
quantityInteger = [Link]([Link])
price = [Link]([Link])
amountPaid = [Link](amountPaid)

subTotal = quantityInteger * price


salesTax = subTotal * salesTaxRate
grandTotal = subTotal + salesTax

[Link] = [Link]("C")
[Link] = [Link]("C")
[Link] = [Link]("C")
[Link] = [Link]("C")

accumulatedTotal += grandTotal
[Link] = [Link]("C")
accumulatedSalesTax += salesTax
[Link] = [Link]("C")

totalTransaction += 1
[Link] = (accumulatedTotal / totalTransaction)

Catch ex As Exception

[Link]("Error.... Please enter appropriate character")

End Try

End Sub
Private Sub averageSaleLabel_Click(sender As Object, e As EventArgs) Handles
[Link]

End Sub

Private Sub ClearButton_Click(sender As Object, e As EventArgs) Handles [Link]


[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()

End Sub

Private Sub ExitButton_Click(sender As Object, e As EventArgs) Handles [Link]


[Link]()

End Sub

Private Sub averageSaleTexTBox_TextChanged(sender As Object, e As EventArgs) Handles


[Link]

End Sub

Private Sub Label3_Click(sender As Object, e As EventArgs) Handles [Link]

End Sub

Private Sub Label4_Click(sender As Object, e As EventArgs) Handles [Link]

End Sub

Private Sub amountPaidLabel_Click(sender As Object, e As EventArgs) Handles


[Link]
Dim amountPaid As Decimal
balance = amountPaid - accumulatedTotal
End Sub
End Class

You might also like