Dustin Wheeler

Dustin Wheeler
Dustin is a technology-driven CPA in Orem, Utah.

Social Media

Follow me on Twitter

Tax Estimate Calculator Created with Visual Basic - Just for Fun

This fall, I am taking a Visual Basic class at UNLV as one of the electives for my Masters Degree in Accounting.  Projects for the class require application of the concepts learned, but allow for creativity because each student can create whatever design or function for the program he or she desires.

My latest project in this class is a form that estimates an amount of tax based on income, itemized deductions and dependents.  It then returns a message to the user in a text box explaining how much tax, if any, is owed.  I know the tax code is much more complicated, but for this project, I used a flat 35% tax rate and $3,000 exemption per dependent.  The project required simple calculations, using IF statements, and returning a message to the user, so there was no need to go into unnecessary detail.

The first step I took was to create the form, text boxes, and button to run the code.  I then wrote the code so that when the “estimate my tax” button is clicked, it calculates the tax, enters the amounts in the text boxes, and returns a message as shown below:

The code to generate the generate the message in the text box is:

If Tax > 0 Then
Message = Name & “, get out your checkbook.  You owe “ & Tax & “.  “
Else
Message = Name & “, you don’t owe any tax.  “
End If

The project works, but it’s a little boring, isn’t it?  I decided to have a little bit of fun with the project by adding an additional IF statement:

If Income > 250000 Then
Message = Message & “Wow!  You’re making more than $250,000.  You’d better hope Congress extends all of the Bush tax cuts!  “
End If

When the amount of income entered is greater than $250,000, the message becomes:

I added another IF statement for the number of dependents:

If Dependents > 10 Then
Message = Message & “By the way, you’re not counting your pets as dependents … are you?”
End If

When the number of dependents is more than ten, the message becomes:

This isn’t a useful program since the tax calculation is inaccurate, but I demonstrated the ability to use IF statements and gave my professor a few laughs while he was grading it (hopefully the laughs were worth a few points)!


Enhanced by Zemanta

2 comments to Tax Estimate Calculator Created with Visual Basic – Just for Fun

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>