title: Exception in thread "main" java.util.NoSuchElementException, Numerous errors
body: <p>I'm pretty new at when it comes to Java and I am having an issue with this new Program that I am designing. I believe it might have something to do with the Scanner, but I am not so sure. I apologize if my formatting is off, this is my first post. Any help would be appreciated.</p>
  
  <pre><code>package commissioncalculationprogram;
  
  import java.util.Scanner;
  
  public class calculate {
      public static void main(String args[]) {
          Scanner input = new Scanner(System.in); // for user input
  
          //create new object to compute compensation and  find the highest earner
          Salesman a = new Salesman ();
  
          System.out.print("How many salespersons do you want to compare: ");
          int SIZE = input.nextInt(); //**** Line 14 in original code ****
  
          String[] name = new String[SIZE];
          double[] sale = new double[SIZE];
          double[] compensation = new double[SIZE];
  
          // input data for each person and compute compensation for that one
          for (int i = 0; i &lt; SIZE; i++) {
              input.nextLine();
              System.out.print("Please enter name of person " + (i+1) + ": ");
              name[i] = input.nextLine();           
              System.out.print("Please enter total annual sales of person " + (i+1) + ": $");
              sale[i] = input.nextDouble();
              compensation[i] = a.calculation(sale[i]);
          }
  
          // find index of the highest earner in array
          int highest = a.highest_earner(compensation, SIZE);
  
          // display the highest earner
          System.out.println("\nThe highest earner is: \n" + name[highest] + 
                         " with total sales: $" + sale[highest] +
                         " and total compensation: $" + compensation[highest]);
  
          // calculate and display the additional amount of sales that each salesperson 
          // must achieve to match or exceed the higher of the two earners
          System.out.println("\nAdditional amount of sales needed for others to match the higgest earners:");
          System.out.format("%-25s%10s\n", "   Name", "Sale amount needed");
  
          for (int i = 0; i &lt; SIZE; i++) {
              if (i == highest) {
                  continue;
              } // skip the highest earner
  
              //System.out.println(name[i] + "\t\t$" + (sale[highest] - sale[i]));
              System.out.format("%-25s%10s\n", name[i], (sale[highest] - sale[i]));
          }
      }
  }
  </code></pre>
  
  <p>When I try to compile the code, I get these errors.</p>
  
  <pre><code>Exception in thread "main" java.util.NoSuchElementException
      at java.util.Scanner.throwFor(Scanner.java:907)
      at java.util.Scanner.next(Scanner.java:1530)
      at java.util.Scanner.nextInt(Scanner.java:2160)
      at java.util.Scanner.nextInt(Scanner.java:2119)
      at commissioncalculationprogram.calculate.main(calculate.java:14)
  </code></pre>
  
  <p>Using the suggestions provided.</p>
  
  <pre><code>    Scanner s = new Scanner(System.in); // for user input
      //create new object to compute compensation and  find the highest earner
      salescalc a = new salescalc ();
      // ask user enter number of salespersons
      int size = 0;
      System.out.print("How many salespersons do you want to compare: ");
      if(s.hasNextInt())
      {
      size = s.nextInt();
      }
      s.close();
  
       New errors
  
       commcalculator/commcalculator.java:30: error: cannot find symbol
          input.nextLine();
          ^
        symbol:   variable input
      location: class commcalculator
      commcalculator/commcalculator.java:32: error: cannot find symbol
          name[i] = input.nextLine();           
                    ^
      symbol:   variable input
      location: class commcalculator
      commcalculator/commcalculator.java:34: error: cannot find symbol
          sale[i] = input.nextDouble();
                    ^
      symbol:   variable input
      location: class commcalculator
      3 errors
  </code></pre>