title: create a salary/bonus calculator
body: <p>I have to create a salary/bonus calculator.</p>
  
  <p>Depending on what salary is enter the bonus will be higher or lower/
  eg. under 20000 will be 7% and over that will be 5.5%.</p>
  
  <p>At the end of it I've to display the total amount of bonuses and the total amount of salaries with the bonus.
  I'm having trouble with the totals when the program is done.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>class Salaries
  {
  
      public static void main(String agrs[])
      {
  
          int salary; // this takes in each salary
          double salaryTotal = 0; // this adds the bonus to to salary
          double bonus = 0; // this hold the bonus amount.
          double sumSalary=0;
          double sumBonus=0;
          String exit = "y";// This is the string to be entered to exit the loop.
  
          // below I'm using a do/while loop to keep it going till a key that isn't "y is entered"
          do
          {
  
          // the try/catch makes sure that only a number is entered.
          try{
              // below prompts the user to enter the salary amount
          System.out.println("Enter an Employes wages.");
          // below takes in the salary
          salary = EasyIn.getInt();
  
          // if else ensure that the salary is not below 0  
          // and to determine if the amount of bonus to be added.
          if (salary &lt;=-1)
          {
          System.out.println("The salary can not be less than 0");
          }
  
          else if  (salary &gt;0 &amp;&amp; salary &lt;=20000)
              {
              bonus = salary*7/100; // This takes the entered salary and calculates the bonus.
              salaryTotal = salary + bonus;
              System.out.println("The bonus paid is " + bonus);
              System.out.println("********************");
              System.out.println("The total salary + bonus is " + salaryTotal);
              System.out.println("********************");
              System.out.println("Enter y to enter another Employes wages. ");
  
              System.out.println("Press any other letter to exit.");
              System.out.println("********************");
              System.out.println();
              exit = EasyIn.getString();
  
              }
          else if (salary &gt;20000 &amp;&amp; salary &lt;=30000)
              {
              bonus = salary*5.5/100; // This takes the entered salary and calculates the bonus.
              salaryTotal = salary + bonus;
              System.out.println("The bonus paid is " + bonus);
              System.out.println("********************");
              System.out.println("The total salary + bonus is " + salaryTotal);
              System.out.println("********************");
              System.out.println("Enter y to enter another Employes wages. ");
  
              System.out.println("Press any other letter to exit.");
              System.out.println("********************");
              System.out.println();
              exit = EasyIn.getString();
  
  
              }
  
          else if (salary &gt;30000 &amp;&amp; salary &lt;=40000)
              {
  
              bonus = salary*4/100;
              salaryTotal = salary + bonus; // This takes the entered salary and calculates the bonus.
              System.out.println("The bonus paid is " + bonus);
              System.out.println("********************");
              System.out.println("The total salary + bonus is " + salaryTotal);
              System.out.println("********************");
              System.out.println("Enter y to enter another Employes wages. ");
  
              System.out.println("Press any other letter to exit.");
              System.out.println("********************");
              System.out.println();
              exit = EasyIn.getString();
  
  
              }
  
          else if (salary &gt;40000)
              {
              bonus = salary*3.5/100;
              salaryTotal = salary + bonus; // This takes the entered salary and calculates the bonus.
              System.out.println("The bonus paid is " + bonus);
              System.out.println("********************");
              System.out.println("The total salary + bonus is " + salaryTotal);
              System.out.println("********************");
              System.out.println("Enter y to enter another Employes wages. ");
  
              System.out.println("Press any other letter to exit.");
              System.out.println("********************");
              System.out.println();
              exit = EasyIn.getString();
  
  
  
              }
  
  
  
  
          }
          catch(Exception e)
          {
              System.out.println("ERROR!!!! Please enter a number.");
          }
  
  
          }
  
  
          while(exit.equals("y"));
  
  
          System.out.println("The total amout of bonus is " + sumBonus );
          System.out.println("The total of all the salaries is " + sumSalary);
  
  
  
      }
  
  
  
  
  }
  </code></pre>