Assignment #68 and ReverseHiLo

Code

      // Name: Jason Kim
      /// Period: 7
      /// Program Name: ReverseHiLo
      /// File Name: ReverseHiLo.java
      /// Date Finished:11/9/15
      
      import java.util.Scanner;
      
      public class ReverseHiLo
      {
          public static void main(String [] args)
          {
              int lo = 1,hi = 1000, guess;
              String answer;
              Scanner keyboard = new Scanner(System.in);
              System.out.println("Think of a number from 1 to 1000. I'll try to guess it.");
              guess = ((lo + hi ) / 2);
              System.out.println("My guess is " + guess + ". Am I too (h)igh, too (l)ow, or (c)orrect?");
              answer = keyboard.next();
              while ( !answer.equals("c") )
              {
                  if ( answer.equals("h") )
                  {
                      hi = guess;
                      guess = ((lo + hi ) / 2);
                  }
                  else
                  {
                      lo = guess;
                      guess = ((lo + hi ) /2);
                  }
                  System.out.println("My guess is " + guess + ". Am I too (h)igh, too (l)ow, or (c)orrect?");
                  answer = keyboard.next();
              }
              System.out.println("\nHa! I am the greatest guesser in the WORLD!");
          }
      }
              
    

Picture of the output

Assignment68