Advertisement
Guest User

poop

a guest
Feb 22nd, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class TaxCalc
  2.  
  3.     Dim TAX As Double = "0" 'Will use TAX as my print variable and it will hold the equation
  4.  
  5.     Private Sub AddBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddBtn.Click
  6.  
  7.         'making TAX equal to the tax formula equation I came up with based on the value of the IncomeTxtBox input.
  8.        If IncomeTxtBox.Text = "" Then
  9.             MsgBox("! PLEASE ENTER A VALUE !")
  10.         ElseIf IncomeTxtBox.Text <= 8025 Then
  11.             TAX = IncomeTxtBox.Text * 0.1
  12.         ElseIf IncomeTxtBox.Text > 8025 And IncomeTxtBox.Text < 32550 Then
  13.             TAX = (IncomeTxtBox.Text - 8025) * 0.15 + 802.5
  14.         ElseIf IncomeTxtBox.Text > 32550 And IncomeTxtBox.Text < 78850 Then
  15.             TAX = (IncomeTxtBox.Text - 32550) * 0.25 + 4481.25
  16.         ElseIf IncomeTxtBox.Text > 78850 And IncomeTxtBox.Text < 164550 Then
  17.             TAX = (IncomeTxtBox.Text - 78850) * 0.28 + 16056.25
  18.         ElseIf IncomeTxtBox.Text > 164550 And IncomeTxtBox.Text < 357700 Then
  19.             TAX = (IncomeTxtBox.Text - 164550) * 0.33 + 40052.25
  20.         ElseIf IncomeTxtBox.Text > 357700 Then
  21.             TAX = (IncomeTxtBox.Text - 357700) * 0.35 + 103791.75
  22.         End If
  23.  
  24.         IncomeTxtBox.Text = FormatCurrency(IncomeTxtBox.Text)
  25.         TAX = FormatCurrency(TAX)
  26.  
  27.         'If nothing was entered in the box, do nothing (besides popping up the msg box in the previous IF statement. Else, proceed to make the calculations and print the income entered and tax.
  28.        If IncomeTxtBox.Text = "" Then
  29.             'left blank so nothing is added to the List Box if nothing is put into the Text Box.
  30.        Else
  31.             ResultListBox.Items.Add("INCOME: " & IncomeTxtBox.Text & "   TAX: " & TAX)
  32.             IncomeTxtBox.Clear() 'clears the List box automatically after button press incase user wants to put more values.
  33.        End If
  34.  
  35.  
  36.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement