Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dblTaxableIncome As Double
dblTaxableIncome = CDbl(txtInput.Text)
Calculate(dblTaxableIncome)
End Sub
Private Sub Calculate(ByVal dblTaxableIncome As Double)
Dim dblTaxesDue As Double = 0
If dblTaxableIncome > 0 And dblTaxableIncome <= 7150 Then
dblTaxesDue = dblTaxableIncome * 0.1
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
ElseIf dblTaxableIncome > 7150 And dblTaxableIncome <= 29050 Then
dblTaxesDue = 715 + (dblTaxableIncome * 0.15)
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
ElseIf dblTaxableIncome > 29050 And dblTaxableIncome <= 70350 Then
dblTaxesDue = 4000 + (dblTaxableIncome * 0.25)
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
ElseIf dblTaxableIncome > 70350 And dblTaxableIncome <= 146750 Then
dblTaxesDue = 14325 + (dblTaxableIncome * 0.28)
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
ElseIf dblTaxableIncome > 146750 And dblTaxableIncome <= 319100 Then
dblTaxesDue = 35717 + (dblTaxableIncome * 0.33)
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
ElseIf dblTaxableIncome > 319100 Then
dblTaxesDue = 92592.5 + (dblTaxableIncome * 0.35)
lstOutput.Items.Add("Your federal tax due is " & FormatCurrency(dblTaxesDue, 2) & ".")
Else
MsgBox("Something Broke. Was your input a number? If not, try again.")
End If
End Sub
End Class