How do you add sales tax?

How would I add a 2% sales tax and a $5 shipping charge to the total price?

  • How would I add a 2% sales tax and a $5 shipping charge to the total price(Don't charge sales tax on the shipping) -Visual Basic . How would the code look and where would I put the code at Option Explicit On Option Strict On Option Infer Off ' Project name: Moonbucks Project ' Project Purpose: Calculates the total pounds of coffee ' ordered and the total price ' Created/revised by: <Aswad Burnett> on <Feburary 12,2012> Public Class MainForm Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click Me.Close() End Sub Private Sub printButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles printButton.Click PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview PrintForm1.Print() End Sub Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click ' prepares the screen for the next order nameTextBox.Text = String.Empty addressTextBox.Text = String.Empty cityTextBox.Text = String.Empty stateTextBox.Text = String.Empty zipTextBox.Text = String.Empty regularTextBox.Text = String.Empty decafTextBox.Text = String.Empty totalPoundsLabel.Text = String.Empty totalPriceLabel.Text = String.Empty nameTextBox.Focus() End Sub Private Sub calcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calcButton.Click ' calculates total pounds ordered and total price ' declare constant and variables Const PricePerPound As Double = 11.15 Dim regularCoffee As Integer Dim decafCoffee As Integer Dim totalPounds As Integer Dim totalPrice As Integer ' assign input to variables Integer.TryParse(regularTextBox.Text, regularCoffee) Integer.TryParse(decafTextBox.Text, decafCoffee) ' perform calculations totalPounds = regularCoffee + decafCoffee totalPrice = CInt(totalPounds * PricePerPound) ' display calculated results totalPoundsLabel.Text = Convert.ToString(totalPounds) totalPriceLabel.Text = totalPrice.ToString("C2") clearButton.Focus() End Sub End Class

  • Answer:

    Looks like totalPrice contains your total that you want to add tax to, right? If so you can do something like grandTotal = ((totalPrice *1.02) + 5).ToString("c2")

Asburnet... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

totalPrice = totalPounds * PricePerPound * 1.02 + 5 And you could use it any time after you got the pounds.

How would I Know

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.