title: Switch statement + user input
body: <p>Thanks for taking your time to help me. I need this switch statement to only accept ints 1-4. Any others entered will ask for input again. Entering 5 will quit the system.</p>
  
  <pre><code>     System.out.println("A random numbers list has been generated for you:\n ");
  
       System.out.println("Choose an option:\n1)Form list to be heapified.\n2)Enqueue the integer 10" +
          "\n3)Dequeue the integer 10.\n4)Print the updated heap.\n5)Quit the system \n&gt;&gt;"); 
       Scanner scanner = new Scanner( System.in );
       int var = 0;
       String input = scanner.next();
       int answer = Integer.parseInt(input);
  
       do{
          input = scanner.next();
          answer = Integer.parseInt(input);
          var = answer;
  
       switch(var){
          case 1:
             for (int i = 0; i &lt; 20; i++) {
                h.insert(new Integer((int)(100 * Math.random())), i);
             }
             break;
          case 2:
             System.out.println("\nEnqueue-ing 10...\n");
                  pushFoward(10, 20);//priority 20
             break;
          case 3:
          System.out.println("\nDequeue-ing 10...\n");
              dequeue;//priority highest deleted
  
             break;
          case 4:
             while (h.heapsize() &gt; 0) {
                System.out.print(h.pop() + " ");
             } 
             break;
       } 
       }while(var ==1 || var==2 || var==3
       || var==4);
  </code></pre>
  
  <p>I cant seem to get it right. Keep making it worse.</p>
  
  <p>Edited:</p>
  
  <pre><code> do{
      String input = scanner.next();
               int answer = Integer.parseInt(input);
       switch(var){
          case 1:
             for (int i = 0; i &lt; 20; i++) {
                h.insert(new Integer((int)(100 * Math.random())), i);
             }
             break;
          case 2:
             System.out.println("\nEnqueue-ing 10...\n");
                  h.pushFoward(10, 20);//priority 20
             break;
          case 3:
          System.out.println("\nDequeue-ing 10...\n");
              h.dequeue();//priority highest deleted
  
             break;
          case 4:
             while (h.heapsize() &gt; 0) {
                System.out.print(h.pop() + " ");
             } 
             break;
             default: input = scanner.next();
              break;
       } 
       }while(var!=5)
  </code></pre>
  
  <p>;</p>