Note that there are some explanatory texts on larger screens.

plurals
  1. POJava program hangs
    text
    copied!<p>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.</p> <pre><code>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 &lt;9000) { incometax = 0; afterincometax = income - incometax; } else if (income &gt;=9000 &amp;&amp; income &lt;=21000) { incometax = (income * 0.15F); afterincometax = income - incometax; } else if (income &gt;=21000 &amp;&amp; income&lt;=31000) { incometax = income * 0.2F; afterincometax = income - incometax; } else if (income &gt;=31000 &amp;&amp; income&lt;=50000) { incometax = income * 0.225F; afterincometax = income - incometax; } else { incometax = income * 0.25F; afterincometax = income - incometax; } if(income &lt; 16000) { nationalinsurance = 0; afterni = income - nationalinsurance; } else if(income &gt;= 16000 &amp;&amp; income &lt;= 31000) { nationalinsurance = income*0.05F; afterni = income - nationalinsurance; } else if(income &gt; 31000 &amp;&amp; income &lt;=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) ; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload