# Java IRS Programming Help. Please Save me!

• 10-14-2010, 06:08 AM
socboy6579
Java IRS Programming Help. Please Save me!
I need help with this program ! :( i dont have a good ideaa on how to do this

Federal income tax rates can be calculated using tax rate schedules. The following are tax rates for two out of the four categories used by the IRS in 2001:

Schedule X - Single

over - but not over - your tax is of the amount over -
\$ 0 \$ 27,050 15 % \$ 0
27,050 65,550 \$ 4,057.50 + 27.5 % 27,050
65,550 136,750 \$ 14,645.00 + 30.5 % 65,550
136,750 297,350 \$ 36,361.00 + 35.5 % 136,750
297,350 --------- \$ 93,374.00 + 39.1 % 297,350

Schedule Y-1 - Married filing jointly

over - but not over - your tax is of the amount over -
\$ 0 \$ 45,200 15 % \$ 0
45,200 109,250 \$ 6,780.00 + 27.5 % 45,200
109,250 166,500 \$ 24,393.75 + 30.5 % 109,250
166,500 297,350 \$ 41,855.00 + 35.5 % 166,500
297,350 --------- \$ 88,306.00 + 39.1 % 297,350

To test your understanding, follow this example of a single person with taxable income of \$68,000:
Tax is \$14,645.00 + 0.305*(68000-65550) = \$14,645.00 + \$747.25 = \$15,392.25

Assignment:

1. One of the biggest mistakes that beginning programmers tend to make is to attempt solving the problem within their code before they really understand how to work the problem. Use the following values and solve each of them before you begin to write your program out.

a. \$50,000 Married __________
b. \$25,000 Single __________
c. \$300,000 Married __________
d. \$170,000 Single __________
e. \$30,000 Married __________
f. \$500,000 Single __________
g. \$170,000 Married __________
h. \$45,000 Single __________
i. \$130,000 Married __________
j. \$120,000 Single __________

2. Write a class that:

a. Prompts the user for the following information:
Filing status: Single or Married (entered as 1 for Single and 2 for Married)
Taxable income

b. Calculates and prints:
Filing status
Taxable income
Federal tax

3. Example run:

Enter marital status (1=single, 2=married): 1
Enter taxable income: \$ 35125
Your Federal tax = \$ 6,278.13

4. Use these values for your run output:

Single, \$15,500

Single, \$100,000

Single, \$ 480,000

Married, \$50,000

Married, \$125,000

Married, \$ 400,000
• 10-14-2010, 06:12 AM
Fubarable
Hello, and welcome to the forum.

So in essence what you've done is to give us your entire assignment without asking a question and without showing any evidence of effort on your part, and I'm afraid that in this situation there's not much that we can do for you other than to direct you to a tutorial or two.

I suggest that you post your best solution that you've created so far, and ask as specific questions as possible, and we'll be much better able to help. If you really have no idea how to begin here, then please have a look here: Starting Writing a Program. It's a well-written article that can help.

Much luck
• 10-14-2010, 06:36 AM
Fubarable
Again, please respond: what part of this assignment are you not sure of? What have you tried? What isn't working? If you can ask specific questions, we can give you specific answers.
• 10-14-2010, 06:39 AM
socboy6579
i was wondering on how to start the code. i think to my knowledge that you have to import a scanner to get it to command what it is asking for such as the maritial status and federal tax
• 10-14-2010, 06:42 AM
Fubarable
Quote:

Originally Posted by socboy6579
i was wondering on how to start the code. i think to my knowledge that you have to import a scanner to get it to command what it is asking for such as the maritial status and federal tax

Yes, a Scanner object can be created and used to obtain input from the user. You'd prompt the user with a System.out.print("...") call, and then obtain their input with your Scanner object, and then use that input to calculate the tax. Have you done the first part of the assignment: calculate the tax on paper for examples a. through j. before trying to code it in Java?
• 10-14-2010, 06:48 AM
socboy6579
so to find out the mariatal status

I would do
System.out.println("Enter Martial Status");

? Like that but then it says to enter 1 or 2 to get married or single i dont know how to do that
• 10-14-2010, 06:50 AM
Fubarable
Quote:

Originally Posted by socboy6579
so to find out the mariatal status

I would do
System.out.println("Enter Martial Status");

? Like that but then it says to enter 1 or 2 to get married or single i dont know how to do that

I would simply take the string as it was written word-for-word up to the spot where the user enters his input and stuff it into a print method:

Code:

`System.out.print("Enter marital status (1=single, 2=married): ");`
There's no magic here -- it's simply the String that the teacher gave you in the assignment.

I prefer print over println here since it forces the user to answer on the same line that the prompt is on.
• 10-14-2010, 06:59 AM
socboy6579
so far i only have this. can you tell me if this is goiung to be a long program

import java.util.Scanner;
public class Taxes {

public static void main(String[] args) {
System.out.print("Enter marital status (1=single, 2=married) ");
• 10-14-2010, 07:01 AM
Fubarable
Quote:

Originally Posted by socboy6579
so far i only have this. can you tell me if this is goiung to be a long program

Sorry but your question makes no sense. What does it matter how long it is as long as it solves the problem? Also, uou still haven't answered my question: have you solved the first part of your assignment? Do you understand the math required to do the coding?
• 10-14-2010, 07:02 AM
socboy6579
yes i do understand the math. for that i would use if statements? is that part of the code correct? or no
• 10-14-2010, 07:06 AM
Fubarable
Quote:

Originally Posted by socboy6579
yes i do understand the math. for that i would use if statements? is that part of the code correct? or no

If statements could work there, yes.

Quite frankly, you've got some work ahead of you to do, and if you seek confirmation for each step of your program before you code it, it's going to be a long hard ride. Instead, you may want to leave the forum and instead just try to write your program. Then please feel free to come on back if you get stuck in a spot or if the code fails to work as you expect it to.
• 10-14-2010, 07:17 AM
socboy6579
i just have one more question. When it says enter marital status how do i make the program recognize that the 1 means single and the 2 means married