Assignemnt #68 and Reverse Hi-Lo

Code

import java.util.Scanner;
public class ReverseHiLo
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        int hi, lo, guess;
        lo = 1;
        hi = 1000;
        guess = ( lo + hi ) / 2;
        String answer;
            
        System.out.println( "Think of a number from 1 to 1000. I'll try to guess it. ");
        System.out.println( "My first guess is " + ( lo + hi ) / 2 + ". Am I too (h)igh, too (l)ow, or (c)orrect? ");
        answer = keyboard.next();
            
        while ( !answer.equals("c"))
        {
            
            if ( answer.equals("h"))
            {
                hi = ( lo + hi ) / 2;
                System.out.println( "My guess is " + ( lo + hi ) / 2 + ". Am I too (h)igh, too (l)ow, or (c)orrect? ");
            }
            else if ( answer.equals("l"))
            {
                lo = ( lo + hi ) / 2;
                System.out.println( "My guess is " + ( lo + hi ) / 2 + ". Am I too (h)igh, too (l)ow, or (c)orrect? ");
            }
            System.out.print("> ");
            answer = keyboard.next();
        }
            
        if ( answer.equals("c") )
            System.out.println( "Ha! I am the greatest guesser in the world! ");
                
    }
}

    

Picture of the output

Assignment 68