Assignemnt #68 and Reverse Hi-Lo

Code

  /// Name: Marco Correa
  /// Period: 5
  /// Program Name: Reverse Hi-Lo
  /// File Name: ReverseHiLo.java
  /// Date Finished: 1/11/2016



  import java.util.Scanner;

  public class ReverseHiLo
  {
	  public static void main ( String[] args )
	  {
        
              Scanner keyboard = new Scanner(System.in);
            
              int hi = 1000;
              int lo = 1;
              int x = (hi + lo)/2;
              String response;
            
              System.out.println("Think of a number from 1 to 1000. I'll try to guess it.");
              System.out.println("My guess is " + x + ". Am I too high, too low, or correct?");
              response = keyboard.next();
            
              while (! response.equals("correct"))
              {
                  if (response.equals("high"))
                      hi = x;
                  else if (response.equals("low"))
                      lo = x;
                
                  x = (hi + lo)/2;
                
                  System.out.println("My guess is " + x + ". Am I too high, too low, or correct?");
                  response = keyboard.next();
              }
            
              System.out.println("Ha! I am the greatest guesser in the WORLD!");
          }
      }

    

Picture of the output

Assignment 68