Results 1 to 19 of 19
Thread: I need a little help
- 02-21-2011, 09:35 PM #1
Member
- 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.
- 02-21-2011, 09:48 PM #2
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Have you made an attempt? If so, post what is not working for you, with relevant code.
- 02-21-2011, 10:05 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-21-2011, 10:16 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-21-2011, 10:22 PM #5
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-21-2011, 10:35 PM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
lol, whats with the angry c++ fanboi?
Show your code and let us see what you have so far please.
- 02-21-2011, 10:41 PM #7
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-21-2011, 10:44 PM #8
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
There is all the vaariablesJava Code:double YPay_After_ProvTax, MPay_After_ProvTax, First_Line, Second_Line, Third_Line, Fourth_Line;
Last edited by Jamesing; 02-21-2011 at 10:57 PM.
-
Moderator action: Notsopro has been banned for abuse posts.
- 02-22-2011, 12:18 AM #10
- 02-22-2011, 12:39 AM #11
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-22-2011, 12: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.
- 02-22-2011, 12:50 AM #13
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-22-2011, 12:59 AM #14
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
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; 02-22-2011 at 01:00 AM. Reason: appropiate did not contain a 'g' when I went to school
- 02-22-2011, 01:06 AM #15
Member
- Join Date
- Feb 2011
- Posts
- 16
- Rep Power
- 0
- 02-22-2011, 01:18 AM #16
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
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
- 02-22-2011, 01:24 AM #17
- 02-22-2011, 01:25 AM #18
Member
- 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.
- 02-22-2011, 01:29 AM #19
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks