So for my Java programming class one of the assesments is the following (a classic number guessing game): 

> 
> Write a program that plays the Hi­Lo guessing game with
>  numbers. The program should pick a random number between 11 (inclusive) and 88 (exclusive), then
>  repeatedly prompt the user to guess the number. On each guess, report to the user that he or she is
>  correct or that the guess is high or low. Continue accepting guesses until the user guesses correctly or
>  choose to quit. Use a sentinel value to determine whether the user wants to quit. Count the number of
>  guesses and report that value when the user guesses correctly. At the end of each game (by quitting or
>  a correct guess), prompt to determine whether the user wants to play again. Continue playing games
>  until the user chooses to stop. You are required to utilise at least a while loop and a for loop correctly.
> 
> 
> 

So far, the game is fully working, using WHILE and IF functions. But in order to get full marks on my solution, it requires me to use at least one FOR loop, but I'm struggling to do that.

```
import java.util.*;
public class Guessing {
    public static void main (String[] args)
 {
 //Setting up the variables
 final int MAX = 88;
 final int MIN = 11;
 int answer, guess = 1;
 String another="Y";

 //Intializing scanner and random
 Scanner scan = new Scanner (System.in);
 Random generator = new Random();
 //play again loop
 while (another.equalsIgnoreCase("Y"))
 {
    //Generate a random number between 11 and 88
    answer = generator.nextInt(MAX-MIN)+11;

    System.out.print ("Guess the number I picked between "+MIN+" and "
               + MAX + "!\n");

    while(guess!=answer)
    {
       System.out.println("Enter your guess: ");
       guess = scan.nextInt();
       System.out.println(answer);

       if (guess<answer && guess != 0)
           System.out.println("Your guess was too low! (0 to exit) ");
       else if (guess>answer)
           System.out.println("Your guess was too high!(0 to exit) "); 
       else if (guess==0){
           System.out.println("You excited the current round.");
           break;}
       else{ 
           System.out.println("Your guess was correct!");
           break;}
       }
    }
    //Asking player to play another game
    System.out.println("Do you want to play another game?(Y|N)");
    another = scan.next();
    if (another.equalsIgnoreCase("N"))
        System.out.println("Goodbye, thank you for playing");
 }
}
}

```

So far, the program works. It correctly gives higher/lower advice, the current round stops when typing in 0 as a guess and you can start another round with Y/N. But Im struggling to substitute one of the functions/loops with a FOR loop.