Results 1 to 6 of 6
Thread: Need Immediate Help!
- 03-25-2011, 12:32 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 23
- Rep Power
- 0
Need Immediate Help!
I have an assignment due in an hour and twenty minutes.
Here is my code:
I'm getting a bunch of errors for the if statement section of the program. The error says " ')' expected ".Java Code:import java.util.Scanner; public class IncomeTax { public void calculateIncomeTax() { Scanner input = new Scanner( System.in ); int classification; int taxAmount; double result; System.out.printf( "%17s%7s%41s%25s%17s\n", "Marginal Tax Rate", "Single", "Married Filing Jointly Or Qualified Widow", "Married Filing Separately", "Head Of Household" ); System.out.printf( "%3s%11s%12s%11s%12s\n", "10%", "$0 - $7,825", "$0 - $15,650", "$0 - $7,825", "$0 - $11,200" ); System.out.printf( "%3s%17s%18s%17s%17s\n", "15%", "$7,826 - $31,850", "$15,651 - $63,700", "$7,826 - $31,850", "$11,201 - $42,650" ); System.out.printf( "%3s%17s%18s%17s%18s\n", "25%", "$31,851 - $77,100", "$63,701 - $128,500", "$31,851 - $64,250", "$42,651 - $110,100" ); System.out.printf( "%3s%18s%19s%17s%19s\n", "28%", "$77,101 - $160,850", "$128,501 - $195,850", "$64,251 - $97,925", "$110,101 - $178,350" ); System.out.printf( "%3s%19s%19s%18s%19s\n", "33%", "$160,851 - $349,700", "$195,851 - $349,700", "$97,926 - $174,850", "$178,351 - $349,700" ); System.out.printf( "%3s%9s%9s%9s%9s\n\n\n", "35%", "$349,701+", "$349,701+", "$174,851+", "$349,701+" ); System.out.print( "Enter Classification: " ); System.out.print( "1 = Single" ); System.out.print( "2 = Married Filing Jointly Or Qualified Widow" ); System.out.print( "3 = Married Filing Separately" ); System.out.print( "4 = Head Of Household" ); classification = input.nextInt(); System.out.print( "Enter income tax amount: " ); taxAmount = input.nextInt(); if ( classification == 1 ) { if (taxAmount <= 7,825) { result = (.10 * taxAmount); } else if (taxAmount >= 7,826 && taxAmount <= 31,850) { result = (.10 * 7,825) + (.15 * (taxAmount - 7,825)); } else if (taxAmount >= 31,851 && taxAmount <= 77,100) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (taxAmount - 31,850)); } else if (taxAmount >= 77,101 && taxAmount <= 160,850) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (77,100 - 31,850)) + (.28 * (taxAmount - 77,100)); } else if (taxAmount >= 160,851 && taxAmount <= 349,700) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (77,100 - 31,850)) + (.28 * (160,850 - 77,100)) + (.33 * (taxAmount - 160,850)); } else if (taxAmount >= 349,701) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (77,100 - 31,850)) + (.28 * (160,850 - 77,100)) + (.33 * (349,700 - 160,850)) + (.35 * (taxAmount - 349,700)); } } if ( classification == 2 ) { if (taxAmount <= 15,650) { result = .10 * taxAmount; } else if (taxAmount >= 15,651 && taxAmount <= 63,700) { result = (.10 * 15,650) + (.15 * (taxAmount - 15,650)); } else if (taxAmount >= 63,701 && taxAmount <= 128,500) { result = (.10 * 15,650) + (.15 * (63,700 - 15,650)) + (.25 * (taxAmount - 63,700)); } else if (taxAmount >= 128,501 && taxAmount <= 195,850) { result = (.10 * 15,650) + (.15 * (63,700 - 15,650)) + (.25 * (128,500 - 63,700)) + (.28 * (taxAmount - 128,500)); } else if (taxAmount >= 195,851 && taxAmount <= 349,700) { result = (.10 * 15,650) + (.15 * (63,700 - 15,650)) + (.25 * (128,500 - 63,700)) + (.28 * (195,850 - 128,500)) + (.33 * (taxAmount - 195,850)); } else if (taxAmount >= 349,701) { result = (.10 * 15,650) + (.15 * (63,700 - 15,650)) + (.25 * (128,500 - 63,700)) + (.28 * (195,850 - 128,500)) + (.33 * (349,700 - 195,850)) + (.35 * (taxAmount - 349,700)); } } if ( classification == 3 ) { if (taxAmount <= 7,825) { result = .10 * taxAmount; } else if (taxAmount >= 7,826 && taxAmount <= 31,850) { result = (.10 * 7,825) + (.15 * (taxAmount - 7,825)); } else if (taxAmount >= 31,851 && taxAmount <= 64,250) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (taxAmount - 31,850)); } else if (taxAmount >= 64,251 && taxAmount <= 97,925) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (64,250 - 31,850)) + (.28 * (taxAmount - 64,250)); } else if (taxAmount >= 97,926 && taxAmount <= 174,850) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (64,250 - 31,850)) + (.28 * (97,925 - 64,250)) + (.33 * (taxAmount - 97,925)); } else if (taxAmount >= 174,851) { result = (.10 * 7,825) + (.15 * (31,850 - 7,825)) + (.25 * (64,250 - 31,850)) + (.28 * (97,925 - 64,250)) + (.33 * (174,850 - 97,925)) + (.35 * (taxAmount - 174,850)); } } if ( classification == 4 ) { if ( taxAmount <= 11,200 ) { result = (.10 * taxAmount); } else if (taxAmount >= 11,201 && taxAmount <= 42,650) { result = (.10 * 11,200) + (.15 * (taxAmount - 11,200)); } else if (taxAmount >= 42,651 && taxAmount <= 110,100) { result = (.10 * 11,200) + (.15 * (42,650 - 11,200)) + (.25 * (taxAmount - 42,650)); } else if (taxAmount >= 110,101 && taxAmount <= 178,350) { result = (.10 * 11,200) + (.15 * (42,650 - 11,200)) + (.25 * (110,100 - 42,650)) + (.28 * (taxAmount - 110,100)); } else if (taxAmount >= 178,351 && taxAmount <= 349,700) { result = (.10 * 11,200) + (.15 * (42,650 - 11,200)) + (.25 * (110,100 - 42,650)) + (.28 * (178,350 - 110,100)) + (.33 * (taxAmount - 178,350)); } else if (taxAmount >= 349,701) { result = (.10 * 11,200) + (.15 * (42,650 - 11,200)) + (.25 * (110,100 - 42,650)) + (.28 * (178,350 - 110,100)) + (.33 * (349,700 - 178,350)) + (.35 * (taxAmount - 349,700)); } } System.out.println("Income tax amount is " + result); } }
I know I'm a terrible programmer, but I really need some help here.
Here is the assignment:
Income brackets and tax rates
An individual's marginal income tax bracket depends upon their income and their tax-filing classification.There are six tax brackets for ordinary income (ranging from 10% to 35%) and four classifications: single, married filing jointly (or qualified widow or widower), married filing separately, and head of household.
Marginal Tax Rate
Single Married Filing Jointly or Qualified Widow(er) Married Filing Separately Head of Household
10%
$0 – $7,825 $0 – $15,650 $0 – $7,825 $0 – $11,200
15%
$7,826 – $31,850 $15,651 – $63,700 $7,826 – $31,850 $11,201 – $42,650
25%
$31,851 – $77,100 $63,701 – $128,500 $31,851 – $64,250 $42,651 – $110,100
28%
$77,101 – $160,850 $128,501 – $195,850 $64,251 – $97,925 $110,101 – $178,350
33%
$160,851 – $349,700 $195,851 – $349,700 $97,926 – $174,850 $178,351 – $349,700
35%
$349,701+ $349,701+ $174,851+ $349,701+
An individual pays tax at a given bracket only for each dollar within that bracket's range. For example, a single taxpayer who earned $10,000 in 2007 would be taxed 10% of each dollar earned from the 1st dollar to the 7,825th dollar (10% × $7,825 = $782.50), then 15% of each dollar earned from the 7,826th dollar to the 10,000th dollar (15% × $2,175 = $326.25), for a total of $1,108.75. Notice this amount ($1,108.75) is lower than if the individual had been taxed at 15% on the full $10,000 (for a tax of $1,500). This is because the individual's marginal rate (the percentage tax on the last dollar earned, here 15%) has no effect on the income taxed at a lower bracket (here the first $7,825 of income taxed at 10%). This ensures that every rise in a person's pre-tax salary results in an increase of their after-tax salary, contrary to the popular misconception that being bumped into a higher tax bracket reduces after-tax income.Last edited by EpyonCustom; 03-25-2011 at 12:35 AM.
- 03-25-2011, 12:59 AM #2
Member
- Join Date
- Mar 2011
- Posts
- 23
- Rep Power
- 0
Only 48 minutes left! Please! Anyone?
- 03-25-2011, 01:16 AM #3
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Show us the exact error messages(copy/paste, no paraphrasing) also, I understand you are in a time crunch but bumping and asking for immediate help tends to get the post less views and help.
- 03-25-2011, 01:18 AM #4
Member
- Join Date
- Mar 2011
- Posts
- 94
- Rep Power
- 0
For starters, remove the commas in all of your amounts. That's a syntax error.
- 03-25-2011, 01:36 AM #5
Member
- Join Date
- Mar 2011
- Posts
- 23
- Rep Power
- 0
Thanks for the help guys. I removed the commas, which fixed one of the issues, but I don't have time to fix the other issues, so I just submitted the assignment.
This is a lesson to everyone out there...don't procrastinate!
- 03-25-2011, 01:38 AM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks