Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
I’m using VB 2008. I need to write a simple program that calculates total sales of purchases. The program should accept item co...Asked by Brenda
I’m using VB 2008. I need to
write a simple program that calculates total sales of purchases. The program should accept item costs as input calculate the tax on each item (8%) display the item cost, total cost, and total after taxes. Item costs will be added to a listbox while the total without the taxes will be displayed in a label, the tax amount in another label, and finally, the total cost (items cost + tax) in a third label.
*******CODE********
Public Class Form1
Dim strTotal As Double = 0
Private Sub txtItemCost_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtItemCost.Enter
' select the Item Cost
txtItemCost.SelectAll()
End Sub
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
' declare valiables
Dim strTaxAmt As Double
Dim strTotalTax As Double
Dim strItemCost As Double
Dim strTotal As Double
' add items listbox
strItemCost = CDbl(lstItemCosts.Text)
strTotal = strTotal + strItemCost ' add to running total
' calculates totals
strTaxAmount = strTotal * 0.08
strTotalWTax = strTotal + strTaxAmount
txtTotal.Text = strTotal
txtTaxAmount.Text = strTaxAmount
txtTotalWTax.Text = strTotalWTax
' insert a dollar sign as the first character
strTotal = strTotal(0, "$"), "Currency")
strTaxAmount = strTaxAmount(0, "$")
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
write a simple program that calculates total sales of purchases. The program should accept item costs as input calculate the tax on each item (8%) display the item cost, total cost, and total after taxes. Item costs will be added to a listbox while the total without the taxes will be displayed in a label, the tax amount in another label, and finally, the total cost (items cost + tax) in a third label.
*******CODE********
Public Class Form1
Dim strTotal As Double = 0
Private Sub txtItemCost_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtItemCost.Enter
' select the Item Cost
txtItemCost.SelectAll()
End Sub
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
' declare valiables
Dim strTaxAmt As Double
Dim strTotalTax As Double
Dim strItemCost As Double
Dim strTotal As Double
' add items listbox
strItemCost = CDbl(lstItemCosts.Text)
strTotal = strTotal + strItemCost ' add to running total
' calculates totals
strTaxAmount = strTotal * 0.08
strTotalWTax = strTotal + strTaxAmount
txtTotal.Text = strTotal
txtTaxAmount.Text = strTaxAmount
txtTotalWTax.Text = strTotalWTax
' insert a dollar sign as the first character
strTotal = strTotal(0, "$"), "Currency")
strTaxAmount = strTaxAmount(0, "$")
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
Answers
Answered by
MattsRiceBowl
What exact problem are you seeing when you run the program? If I start there, it is usually easier to solve.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.