Create a program using VB 2008 software. Asks the user to enter the name of a St
ID: 3631680 • Letter: C
Question
Create a program using VB 2008 software. Asks the user to enter the name of a State and an amount and then the program will compute and display the amount of tax due on that amount and also state the input values. Use the following tax rates and corresponding States as listed below. You may use the State abbreviation in your program.California (CA) 9.75%
Florida (FL) 6%
Hawaii (HI) 0%
New York (NY) 4%
Texas (TX) 6.25%
An example run of the program should show output as shown below in a text box based on the input of "California" or "CA" and "100" dollars:
Explanation / Answer
This should get you started. I used a list box, but you can just change it to a text box for the result if you need to. I also used the abbreviations instead of full name. Public Class Form1 Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click Dim state As String Dim price As Double Dim total As Double 'get values for text boxes state = txtState.Text.ToUpper price = txtPrice.Text 'get tax and calculate the total Select Case state Case "CA" total = (0.0975 * price) + price lstResult.Items.Add(FormatCurrency(total)) Case "FL" total = (0.06 * price) + price lstResult.Items.Add(FormatCurrency(total)) Case "HI" total = price lstResult.Items.Add(FormatCurrency(total)) Case "NY" total = (0.04 * price) + price lstResult.Items.Add(FormatCurrency(total)) Case "TX" total = (0.0625 * price) + price lstResult.Items.Add(FormatCurrency(total)) End Select End Sub End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.