Results 1 to 19 of 19
Thread: I need a little help
 02212011, 10:35 PM #1Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
I need a little help
Hi, I'm making a program that will calculate tax deductions for certain salaries and I need help on part of it. I need to know how to do this to a single value:
9.1% off the first $37,149 , +
12.1% off the next $36,422, +
12.4% off the next $46,496, +
12.7% off the amount over $120,796
However, sometimes the value may not be 120796 or greater, obviously, so I want to make it so, it will execute it accordingly. Thanks.
 02212011, 10:48 PM #2Senior Member
 Join Date
 Feb 2010
 Location
 Waterford, Ireland
 Posts
 748
 Rep Power
 5
Have you made an attempt? If so, post what is not working for you, with relevant code.
 02212011, 11:05 PM #3Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02212011, 11:16 PM #4Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02212011, 11:22 PM #5Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02212011, 11:35 PM #6
 Join Date
 Jan 2011
 Location
 Richmond, Virginia
 Posts
 3,069
 Blog Entries
 3
 Rep Power
 9
lol, whats with the angry c++ fanboi?
Show your code and let us see what you have so far please.
 02212011, 11:41 PM #7Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02212011, 11:44 PM #8Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
Java Code:double YPay_After_ProvTax, MPay_After_ProvTax, First_Line, Second_Line, Third_Line, Fourth_Line;
Last edited by Jamesing; 02212011 at 11:57 PM.

Moderator action: Notsopro has been banned for abuse posts.
 02222011, 01:18 AM #10
 02222011, 01:39 AM #11Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02222011, 01:47 AM #12
So tell me, if I have a salary of $32,000 how much tax will you deduct and explain how you determined that.
 02222011, 01:50 AM #13Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02222011, 01:59 AM #14Senior Member
 Join Date
 Feb 2010
 Location
 Waterford, Ireland
 Posts
 748
 Rep Power
 5
Use a series of if statements to determine wether the cash amount you wish to apply tax to falls within certain conditons e.g if cash less than or equal to 37149 then do appropiate calculation.
Last edited by al_Marshy_1981; 02222011 at 02:00 AM. Reason: appropiate did not contain a 'g' when I went to school
 02222011, 02:06 AM #15Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
 02222011, 02:18 AM #16Senior Member
 Join Date
 Feb 2010
 Location
 Waterford, Ireland
 Posts
 748
 Rep Power
 5
Keep track of each deduction amount with a variable say called totalDeductions.
Here is some semi real code to look at:
Java Code:int totalDeductions=0; if(yearlyPay <= 37149){ // calculate tax deduction and add it to totalDeductions current amount // totalDeductions+=taxDeduction; } if(yearlyPay <= theNextAmount){ // calculations tax deduction and add it to totalDeductions current amount } // etc if statements for the other amounts
 02222011, 02:24 AM #17
 02222011, 02:25 AM #18Member
 Join Date
 Feb 2011
 Posts
 16
 Rep Power
 0
I'm not sure if that will work, but I will try it. You see, with this formula, there isn't really a next amount. It takes 9.1 percent off the first 37149, then 12.1 percent off the next 36422, so how do I account for the numbers in the middle. Do you think your code will do that? It doesn't look like it will to me, but I could be wrong.
 02222011, 02:29 AM #19Senior Member
 Join Date
 Feb 2010
 Location
 Waterford, Ireland
 Posts
 748
 Rep Power
 5
Bookmarks