In visual basic, write the code for calculating and displaying the tax according
ID: 3606544 • Letter: I
Question
In visual basic, write the code for calculating and displaying the tax according to the forgoing table. You can assume that the user will enter valid a numeric value. The following information might help you validate the code. If the user enters 20000, the calculated tax is $2,565.00 if the user enters 10000, the calculated tax is $21,460.00Please write the code as it should be in visual studio whoever is answering that Question. Give me the code. I do not need explanation. I just need the code according to the table and the application that is devliped on top Assignment 5-Homework Exercise 1 Calculate income tax Before you get started, you are suggested to review Assignment 5 Tutorial Exercise 1 and the In-class Examples to refresh your understanding of the I f statement in VB. In this exercise, you'll use multiple I f statements and arithmetic expressions to calculate the federal income tax that is owed for a taxable income amount entered by the user Income Tax Calculator e 1 Taxcable come 8000 Income tax owed: $16,029.00 Calculate This is the 2012 table for the federal income tax on individuals that you should use for calculating the tax: Taxable income Income tarx From To $388,350 $178,650 $85,650 $35,350 $8,700 so $388,350 (inclusive $178 650 (inclusive) $85,650 (inclusive) 535,350 (inclusive $8,700 (inclusive) $112.683+ (The total income-$388,350) * 35% $43,482 + (Thc total income-$178,650)" 33% $17,442+ (The total income-$85,650) * 28% $4,867-(The total income-$35.350) * 25% $870 + (The total income-$8,700) * 1 5% S0 + The total income 10% For example, when a tax payer's income is $75,000, according to the table, the income tax is $14,779 The formula to calculate the income tax is: 4867+(75000-35350) 0.25 I. Start a new application named TaxCalculator" 2. Make sure that for this application, strict type semanties is applied.
Explanation / Answer
TaxCalculator.vb
--------------------------------------------------------------------------------
Public Class TaxCalculator
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim taxableincome As Decimal = CDec(txtTaxableIncome.Text)
Dim incometaxowed As Decimal
If taxableincome >= 0 AndAlso taxableincome <= 8700 Then
incometaxowed = (0 + taxableincome * 0.1)
ElseIf taxableincome > 8700 AndAlso taxableincome <= 35350 Then
incometaxowed = (870 + (taxableincome - 8700) * 0.15)
ElseIf taxableincome > 35350 AndAlso taxableincome <= 85650 Then
incometaxowed = (4867 + (taxableincome - 35350) * 0.25)
ElseIf taxableincome > 85650 AndAlso taxableincome <= 178650 Then
incometaxowed = (17442 + (taxableincome - 85650) * 0.28)
ElseIf taxableincome > 178650 AndAlso taxableincome <= 388350 Then
incometaxowed = (43482 + (taxableincome - 178650) * 0.33)
ElseIf taxableincome > 388350 Then
incometaxowed = (112683 + (taxableincome - 388350) * 0.35)
End If
txtIncomeTaxOwed.Text = FormatCurrency(incometaxowed)
End Sub
End Class
----------------------------------------------------------------------------------------------------------------
TaxCalculator.Designer.vb
-------------------------------------------------------------------
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class TaxCalculator
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.lblTaxableIncome = New System.Windows.Forms.Label()
Me.lblIncomeTaxOwed = New System.Windows.Forms.Label()
Me.txtTaxableIncome = New System.Windows.Forms.TextBox()
Me.txtIncomeTaxOwed = New System.Windows.Forms.TextBox()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.btnExit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'lblTaxableIncome
'
Me.lblTaxableIncome.AutoSize = True
Me.lblTaxableIncome.Location = New System.Drawing.Point(12, 28)
Me.lblTaxableIncome.Name = "lblTaxableIncome"
Me.lblTaxableIncome.Size = New System.Drawing.Size(85, 13)
Me.lblTaxableIncome.TabIndex = 0
Me.lblTaxableIncome.Text = "Taxable income:"
'
'lblIncomeTaxOwed
'
Me.lblIncomeTaxOwed.AutoSize = True
Me.lblIncomeTaxOwed.Location = New System.Drawing.Point(12, 67)
Me.lblIncomeTaxOwed.Name = "lblIncomeTaxOwed"
Me.lblIncomeTaxOwed.Size = New System.Drawing.Size(91, 13)
Me.lblIncomeTaxOwed.TabIndex = 1
Me.lblIncomeTaxOwed.Text = "Income tax owed:"
'
'txtTaxableIncome
'
Me.txtTaxableIncome.Location = New System.Drawing.Point(137, 25)
Me.txtTaxableIncome.Name = "txtTaxableIncome"
Me.txtTaxableIncome.Size = New System.Drawing.Size(100, 20)
Me.txtTaxableIncome.TabIndex = 2
'
'txtIncomeTaxOwed
'
Me.txtIncomeTaxOwed.Location = New System.Drawing.Point(137, 64)
Me.txtIncomeTaxOwed.Name = "txtIncomeTaxOwed"
Me.txtIncomeTaxOwed.ReadOnly = True
Me.txtIncomeTaxOwed.Size = New System.Drawing.Size(100, 20)
Me.txtIncomeTaxOwed.TabIndex = 3
'
'btnCalculate
'
Me.btnCalculate.Location = New System.Drawing.Point(62, 103)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(75, 23)
Me.btnCalculate.TabIndex = 4
Me.btnCalculate.Text = "Calculate"
Me.btnCalculate.UseVisualStyleBackColor = True
'
'btnExit
'
Me.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnExit.Location = New System.Drawing.Point(162, 103)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(75, 23)
Me.btnExit.TabIndex = 5
Me.btnExit.Text = "Exit"
Me.btnExit.UseVisualStyleBackColor = True
'
'Form1
'
Me.AcceptButton = Me.btnCalculate
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.btnExit
Me.ClientSize = New System.Drawing.Size(260, 140)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.txtIncomeTaxOwed)
Me.Controls.Add(Me.txtTaxableIncome)
Me.Controls.Add(Me.lblIncomeTaxOwed)
Me.Controls.Add(Me.lblTaxableIncome)
Me.Name = "Form1"
Me.Text = "Income Tax Calculator"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents lblTaxableIncome As System.Windows.Forms.Label
Friend WithEvents lblIncomeTaxOwed As System.Windows.Forms.Label
Friend WithEvents txtTaxableIncome As System.Windows.Forms.TextBox
Friend WithEvents txtIncomeTaxOwed As System.Windows.Forms.TextBox
Friend WithEvents btnCalculate As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button
End Class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.