title: Java while loop game
body: <p>I'm doing a program in java that needs me have the user guess the number with only 10 tries and also use a while loop. This is all I currently have, can anyone help as to where to put the while loop and what I'm missing? Thank you.</p>
  
  <pre><code>    import java.util.Scanner;
      import java.util.Random;
  
      public class GuessGame {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          // TODO code application logic here
  
  
  
          Random generator = new Random(); 
  
          Scanner input = new Scanner(System.in);
  
          int numberToGuess = 1 + generator.nextInt(100); 
          int numberOfTries = 0;
          int limit= 10;
          int guess;
  
  
  
         System.out.println ("You have 10 tries to guess a number between 1 and 100");
  
          System.out.print("Guess number 1: ");
          guess= input.nextInt();
          numberOfTries++;
  
  
          if (guess &lt; numberToGuess)
                   System.out.println("Your guess is too low. Try again.");
  
          else if (guess &gt; 100)
                  System.out.println("Guesses should be between 1 and 100.");
  
          else if (guess &gt; numberToGuess)
              System.out.println("Too high. Try again.");
  
          else if (guess == numberToGuess)
              System.out.println("Congratulations!");
  
  
          System.out.print("Guess number 2: ");
          guess= input.nextInt();
          numberOfTries++;
  
  
           System.out.print("Guess number 3: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 4: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 5: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 6: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 7: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 8: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 9: ");
          guess= input.nextInt();
          numberOfTries++;
  
           System.out.print("Guess number 10: ");
          guess= input.nextInt();
          numberOfTries++;            
  
         }
  }
  </code></pre>