Help with code for tax calculator

I cannot figure out what is wrong with my code! When I click on my Results button, all I get is $0.00 for my calculated tax. I would be eternally grateful if someone could tell me what I am doing wrong!

Here is my code:


Public Class Form1

Private Sub BtnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalculate.Click

Dim marstat As String
Dim income As Double = txtTaxIncome.Text
Dim tax As Double
Dim taxpercent As Double
Dim mtax As Double

income = CDbl(txtTaxIncome.Text)

If (radMarried.Checked) Then
marstat = "married"
ElseIf (radSingle.Checked) Then
marstat = "single"
Else : MessageBox.Show("You did not select a Marital Status!")
End If

If marstat = "single" Then 'formula for Single
Select Case income
Case income <= 8375
tax = (income * 0.1)
mtax = 0.1
Case income > 8375 And income <= 34000
tax = ((income - 8375) * 0.15 + 837.5)
mtax = 0.15
Case income > 34000 And income <= 82400
tax = ((income - 34000) * 0.25 + 4861.25)
mtax = 0.25
Case income > 82400 And income <= 171850
tax = ((income - 82400) * 0.28 + 16781.25)
mtax = 0.28
Case income > 171850 And income <= 373, 650
tax = ((income - 171850) * 0.33 + 41827.25)
mtax = 0.33
Case income > 373650
tax = ((income = 373650) * 0.35 + 108421.3)
mtax = 0.35

End Select
End If
If marstat = "married" Then
Select Case income
Case income <= 16750
tax = (income * 0.1)
mtax = 0.1
Case income > 16750 And income <= 68000
tax = ((income - 16750) * 0.15 + 1675)
mtax = 0.15
Case income > 68000 And income <= 137300
tax = ((income - 68000) * 0.25 + 9362.5)
mtax = 0.25
Case income > 137300 And income <= 209250
tax = ((income - 137300) * 0.28 + 26687.5)
mtax = 0.28
Case income > 209250 And income <= 373650
tax = ((income - 209250) * 0.33 + 46883.5)
mtax = 0.33
Case income > 373650
tax = ((income - 373650) * 0.35 + 101085.5)
mtax = 0.35
End Select
End If

txtTaxLia.Text = FormatCurrency(tax)

taxpercent = tax / income
txtPercentIncome.Text = FormatPercent(taxpercent)
txtTaxBracket.Text = FormatPercent(mtax)



End Sub
End Class
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories