Home / Expert Answers / Computer Science / fix-the-visual-basic-code-for-the-following-instructions-nbsp-code-above-for-copy-and-past-pa359

(Solved): FIX THE VISUAL BASIC CODE FOR THE FOLLOWING INSTRUCTIONS:   CODE ABOVE FOR COPY AND PAST ...



FIX THE VISUAL BASIC CODE FOR THE FOLLOWING INSTRUCTIONS:

Before you get started, you are suggested to review Assignment 5 Tutorial Exercise 1 and the in-class examples to refresh you19. Rename the source files of the form to frmCalculateTax.
20. Create an event handler for the Click event of the Exit but

nCalculateTax.vb \( { }^{*} \quad \Varangle \times \) frmCalculateTax.vb [Design]
TaxCalculatortxtIncomeTax0wed. Text = incomeTaxOwed. ToString ( \( \mathrm{C}^{\text { }} \) )
End Sub
End Class

 

CODE ABOVE FOR COPY AND PAST

Public Class frmCalculateTax
    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

        Select Case taxableIncome
            Case taxableIncome
        End Select
        Select Case incomeTaxOwed
                    Case Is <= 8700
                        incomeTaxOwed = (0 + taxableIncome * 0.1D)

                    Case Is <= 35350
                        incomeTaxOwed = (870 + (taxableIncome - 8700) * 0.15D)

                    Case Is <= 85650
                        incomeTaxOwed = (4867 + (taxableIncome - 35350) * 0.25D)

                    Case Is <= 178650
                        incomeTaxOwed = (17442 + (taxableIncome - 85650) * 0.28D)

                    Case Is <= 388350
                        incomeTaxOwed = (43482 + (taxableIncome - 178650) * 0.33D)

                    Case Else
                        incomeTaxOwed = (112683 + (taxableIncome - 388350) * 0.35D)
                End Select

                'If taxableIncome >= 0 AndAlso taxableIncome <= 8700 Then
                'incomeTaxOwed = (0 + taxableIncome * 0.1D)

                'ElseIf taxableIncome > 8700 AndAlso taxableIncome <= 35350 Then
                'incomeTaxOwed = (870 + (taxableIncome - 8700) * 0.15D)

                'ElseIf taxableIncome > 35350 AndAlso taxableIncome <= 85650 Then
                'incomeTaxOwed = (4867 + (taxableIncome - 35350) * 0.25D)

                'ElseIf taxableIncome > 85650 AndAlso taxableIncome <= 178650 Then
                'incomeTaxOwed = (17442 + (taxableIncome - 85650) * 0.28D)

                'ElseIf taxableIncome > 178650 AndAlso taxableIncome <= 388350 Then
                'incomeTaxOwed = (43482 + (taxableIncome - 178650) * 0.33D)

                'ElseIf taxableIncome > 388350 Then
                'incomeTaxOwed = (112683 + (taxableIncome - 388350) * 0.35D)

                'End If

                txtIncomeTaxOwed.Text = incomeTaxOwed.ToString("C")


    End Sub
End Class
 

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 select case statement in VB. In this exercise, you'll use a select case statement and arithmetic expressions to calculate the federal income tax that is owed for a taxable income amount entered by the user. This is the 2012 table for the federal income tax on individuals that you should use for calculating the tax: 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 \) 12. Start a new application named "TaxCalculator". 13. Make sure that for this application, strict type semantics is applied. 14. Add labels, text boxes, and buttons to the default form and set the properties of the form and its controls so they appear as shown above. 15. The start position of the form should be at the center of the screen. 16. The application has a keystroke feature that when the user presses the Enter key, the Click event of the Calculate button should fire. When the user presses the Esc key, the Click event of the Exit button should fire. 17. The application has another keystroke feature that: when the user presses Alt \( +\mathrm{C} \), it activates the Calculate button; when the user presses Alt \( +\mathrm{X} \), it activates the Exit button. 18. When the form is displayed, the focus is on the Taxable income textbox. 19. Rename the source files of the form to "frmCalculateTax". 20. Create an event handler for the Click event of the Exit button that closes the form. 21. Create an event handler for the Click event of the Calculate button. Then, 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 100000 , the calculated tax is \( \$ 21,460.00 \) 22. The computed income tax is displayed in the form of currency with the precision of 2 decimal places. nCalculateTax.vb \( { }^{*} \quad \Varangle \times \) frmCalculateTax.vb [Design] TaxCalculator txtIncomeTax0wed. Text = incomeTaxOwed. ToString (" \( \mathrm{C}^{\text {" }} \) ) End Sub End Class


We have an Answer from Expert

View Expert Answer

Expert Answer


**************** SOLUTION *************** TaxCalculator.vb -------------------------------------------------------------------------------- Public Cla
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe