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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 5 of 5

Thread: Im extremely new to this so dont laugh....does anyone know why this wont run????

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Im extremely new to this so dont laugh....does anyone know why this wont run????

    package incometax;
    import java.util.*;

    // Name of the file

    public class IncomeTax

    //Main Method
    {
    public static void main(String[] args)
    {
    Scanner console = new Scanner(System.in);
    int salary;

    System.out.println("This program calculates your Income tax ");

    System.out.print("Please enter Your Salary: ");
    salary = console.nextInt();

    double tax;
    tax = 0.0;
    //The if statement that determines the users tax on their income

    if (salary <= 50000)
    tax = salary * .01;

    if (salary > 50000 && salary < 75000)
    tax = salary * .02;

    if (salary >= 75000 && salary < 100000)
    tax = salary * .03;

    if (salary >= 100000 && salary < 250000)
    tax = salary * .04;

    if (salary >= 250000 && salary < 500000)
    tax = salary * .05;

    if (salary >= 500000)
    tax = salary * .06;
    System.out.println("Your Salary is $" + salary);
    System.out.println("Your tax on your salary is $" + tax);
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,143
    Thanks
    48
    Thanked 2,157 Times in 2,130 Posts

    Default Re: Im extremely new to this so dont laugh....does anyone know why this wont run????

    Please copy the full text of any error messages and paste it here.

    Please edit your post and wrap your code with code tags:
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Im extremely new to this so dont laugh....does anyone know why this wont run????

    it doesn't show any errors

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,143
    Thanks
    48
    Thanked 2,157 Times in 2,130 Posts

    Default Re: Im extremely new to this so dont laugh....does anyone know why this wont run????

    How are you executing the class?
    What happens when you execute it?

    Copy the full contents of the console window and paste it here.

    Please edit your post and wrap your code with code tags:
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Im extremely new to this so dont laugh....does anyone know why this wont run????

    im not quite sure what you mean, im using netbeans and the program builds and runs fine but nothing happens. All of my brackets have an opposite. I have defined all the variables. Im just not sure why nothing is happening.

Similar Threads

  1. Runnable jar file wont run
    By bobscool123 in forum Object Oriented Programming
    Replies: 6
    Last Post: June 7th, 2013, 11:25 AM
  2. My program will compile but wont run
    By joshp1993 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 23rd, 2012, 07:45 AM
  3. My code has error when its run....I dont understand what's wrong of it.
    By jacky@~ in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 11th, 2011, 07:48 AM
  4. Compliing fine but wont run--please help!
    By Nova in forum What's Wrong With My Code?
    Replies: 6
    Last Post: May 12th, 2010, 07:51 PM
  5. Dont laugh at me
    By Neblin in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 3rd, 2009, 08:18 AM