Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: help with tax program???

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    Default help with tax program???

    I need to create a program that calculates tax, but I dont understand how to do it.
    I used google translate to translate the task so it is not well written.

    The only thing I have started with is this! But i need help with the rest

    String tax=JOptionPane.showInputDialog("type in your tax class. (1 or 2)");
    int sk=Integer.parseInt(tax);

    String inntekt=JOptionPane.showInputDialog("type in your income.");
    int i=Integer.parseInt(income);

    The task looks like this....

    Write a program that reads my tax class (1 or 2) and an income from the user (usually double) program will calculate and print the assessed taxes
    In class 1 is that
    If your income is below 20000, there is no tax.
    If your income is greater than 20000 and less than 100,000 is 20% tax of over 20000
    If your income is over 100,000, it shall be paid 20% tax on income between 20 and 100 thousand and 40% of the excess.
    while Class 2 tax rates, respectively, 15 and 35% and the threshold amount is 50,000 and 150000. The program will repeat the questions and calculations arbitrarily many times. If the user enters tax class 0, then the program ends.

    thanks for help

  2. #2
    Join Date
    Aug 2011
    Thanked 3 Times in 3 Posts

    Default Re: help with tax program???

    You should wrap your code on code tags show its easier to read. Where is the rest of your code? Where exactly are you stuck? One other thing you may
    want to try to name your variables in a more useful way. Like income and taxClass.

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 636 Times in 540 Posts

    Default Re: help with tax program???

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Join Date
    Jul 2011
    Thanked 0 Times in 0 Posts

    Default Re: help with tax program???

    Ok, let's turn this around. What can you do? Can you get a Hello World program to run? If not, the tutorial over at Oracle entitled "Your first cup of Java may be informative. If you can get the computer to do something for you, little by littleyou will get it to do what you want.

Similar Threads

  1. Help with class program!!! STUCK! Program not doing what I Want!!!
    By sketch_flygirl in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 4th, 2011, 07:29 AM

Tags for this Thread