Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:59:32+00:00 2026-05-28T14:59:32+00:00

made a short java program in Bluej upon compiling it and trying to get

  • 0

made a short java program in Bluej upon compiling it and trying to get it to run it, it hangs with no output.
I’ve had this issue before when using the in.next function.
Regards for any help and my apologies for what may seem a simple question.

import java.util.Scanner;

public class net_salary{

public static void main(String[]args){

Scanner in = new Scanner(System.in);



float income;
float incometax;
float afterincometax;
float nationalinsurance;
float afterni;
float pension;
float netincome;

income = in.nextFloat();





if(income <9000)
    {
      incometax = 0;
      afterincometax = income - incometax;

    }
    else if (income >=9000 && income <=21000)
    {
        incometax = (income * 0.15F);
        afterincometax = income - incometax;
    }

    else if (income >=21000 && income<=31000)
    {
        incometax = income * 0.2F;
        afterincometax = income - incometax;

    }

    else if (income >=31000 &&  income<=50000)
    {
        incometax = income * 0.225F;
        afterincometax = income - incometax;
    }

    else
    {
        incometax = income * 0.25F;
        afterincometax = income - incometax;
    }





   if(income < 16000)

   {
       nationalinsurance = 0;
       afterni = income - nationalinsurance;

    }


    else if(income >= 16000 && income <= 31000)
        {

            nationalinsurance = income*0.05F;
            afterni = income - nationalinsurance;
        }
    else if(income > 31000 && income <=40000)
        {

            nationalinsurance = income*0.09F;
            afterni = income - nationalinsurance;
        }
    else
        {

            nationalinsurance = income*0.11F;
            afterni = income - nationalinsurance;
        }





   pension = income *0.05F;

   netincome = ((income - pension)-nationalinsurance)-incometax;

   System.out.println("Your gross income is : £" + income) ;
   System.out.println("Your income tax is : £" + incometax) ;
   System.out.println("Your nationalinsurance  £" + nationalinsurance) ;
   System.out.println("Your pension is : £" + pension) ;
   System.out.println("Your net income is : £" + netincome) ;

}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:59:33+00:00Added an answer on May 28, 2026 at 2:59 pm

    I’m not sure what the issue you are having is. When I run it, it works just fine. It took me a second to realize that it was waiting for user input, but once I figured that out I just typed in a number, hit enter, and it worked. If I were you I would add a prompt to the user, something like:

    System.out.println("Please enter your income: ");
    income = in.nextFloat();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I built this program that works with files. Since I made it for a
I'm trying to make my first android game and to do this I made
Well I made this game in java and when you shoot a bullet it
Made solution change: I am trying to display a html table of data.. In
Made this nice little loop for hiding and showing div's, works as a charm
My environment is: Windows7 32, jboss-5.1.0.GA, jdk1.6.0_20. When trying to run a SOAP-message I
I decided to implement a very simple program recursively, to see how well Java
To make a long story short, I'm having trouble getting a couple of Java
I had to make a Linked List program for my programming class. It works
I'm trying to avoid duplicate data on my Database, so I made UNIQUE columns,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.