Archive for September, 2010

Cash Counting Program I Created with Visual Basic

Twenty, forty, sixty, eighty, one hundred, twenty, forty, sixty, eighty, two hundred, twenty, forty, sixty, eighty … aarrgh!  Where was I? In my previous post, I blogged about all the fun I am having in a Visual Basic class that I am taking at UNLV.  My most recent project is a simple cash and coin counting program.  I will use it for a position I hold in an organization in which I help count cash.  Hopefully, this program will ease the occasional pain and frustration I feel when counting stacks of twenty dollar bills. The user enters the amount of each type of coin and currency.  The program performs the calculations for each type and returns the total amount of coin and currency as seen in the screen shot below. Cash Counting Program
Enhanced by Zemanta

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