Alice Community Tax Calculator

 Tax Calculator
 ekat90 Junior Member   Status: Offline Posts: 6 Join Date: Dec 2012 Location: melb Tax Calculator - 01-04-2013, 11:58 PM Doing another assignment that I'm currently having a little trouble with at the moment, we need to create a tax calculation program that will total incomes, total expenses and calculate the tax payable. Now I'm able to give the user added incomes, but it requires me too create many different variables, and giving addition too all those variables, I'm sure there's a easier and cleaner way that I don't know how to do it from. Here's a video my mentor has given me as a demonstration. View My Video Also I have a link too what I could come up with right now. http://www.2shared.com/file/7dD6zOZf/a2-startup.html from what i figured out you add your incomes till you hit the "-" key and hitting "ok" takes you too the next step the "expenses" once you've done this it subtracts the total amount, like for example income-expense=tax payable(taxable income) With this total amount we need the program too give us a maths calculation through this table that my mentor gave me: Taxable Income \$ ----------- Tax on this income \$ 0-18200 ----------- \$0 \$ 18201-37000 ----------- \$19cents for each \$1 over 18200 \$37001-80000 ----------- \$3572+32.5cents for each \$1 over 37000 \$80001-180,000 ----------- \$17547 plus 37cents for each \$1 over 80000 \$180,001 and over ----------- \$54547 plus 45cents for each \$1 over 180,000 So far I've gotten a massive headache on trying too get this thing right and its killing me right now, if anyone could possible divide some time to help a programmer in frustration just trying to learn to get this thing right, I would appreciate it alot! Last edited by ekat90; 01-05-2013 at 12:05 AM.
 ekat90 Junior Member   Status: Offline Posts: 6 Join Date: Dec 2012 Location: melb please! - 01-05-2013, 09:25 PM if anyone can help me put this program together asap I'm giving out donations to whoever helps, im really desperate.
 Think how do d do this
chickentree
Super Moderator

Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Think how do d do this - 01-06-2013, 03:44 PM

Looking At the problem, you do not need any variables to hold the tax just a number of nested if/ else statements to calculate the tax for each bracket. The easiest way is to start with the top bracket and work your way down.
If income is > 180000
return 54547 + 0.45 * income-180000
else
if income > 80000
...
So create a function that transverses the tree until the income (passed in as a parameter to the function) matches the if statement, then the tax is computed and returned

Mark

Quote:
 Originally Posted by ekat90 Doing another assignment that I'm currently having a little trouble with at the moment, we need to create a tax calculation program that will total incomes, total expenses and calculate the tax payable. Now I'm able to give the user added incomes, but it requires me too create many different variables, and giving addition too all those variables, I'm sure there's a easier and cleaner way that I don't know how to do it from. Here's a video my mentor has given me as a demonstration. View My Video Also I have a link too what I could come up with right now. http://www.2shared.com/file/7dD6zOZf/a2-startup.html from what i figured out you add your incomes till you hit the "-" key and hitting "ok" takes you too the next step the "expenses" once you've done this it subtracts the total amount, like for example income-expense=tax payable(taxable income) With this total amount we need the program too give us a maths calculation through this table that my mentor gave me: Taxable Income \$ ----------- Tax on this income \$ 0-18200 ----------- \$0 \$ 18201-37000 ----------- \$19cents for each \$1 over 18200 \$37001-80000 ----------- \$3572+32.5cents for each \$1 over 37000 \$80001-180,000 ----------- \$17547 plus 37cents for each \$1 over 80000 \$180,001 and over ----------- \$54547 plus 45cents for each \$1 over 180,000 So far I've gotten a massive headache on trying too get this thing right and its killing me right now, if anyone could possible divide some time to help a programmer in frustration just trying to learn to get this thing right, I would appreciate it alot!

 Really just two
 MrMoke Senior Member     Status: Offline Posts: 501 Join Date: Sep 2007 Location: Austin, Texas Really just two - 01-07-2013, 08:23 PM Building two While loops that look for a negative number to stop requires only two variables to hold the summations. After that you can use the two variables to compute the taxable profits variable, and use that variable a few If statements to do the rest. Last edited by MrMoke; 01-07-2013 at 09:11 PM.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge