Assignemnt #68 and Reverse Hi Lo

Code

      ///Name: Dakota Donahue
      ///Period: 5
      ///Project Name: Reverse Hi Lo
      ///File Name: ReverseHiLo.java
      ///Date: 1/12/2016
      
      import java.util.Scanner;

      public class ReverseHiLo
      {
          public static void main( String[] args )
          {
              Scanner keyboard = new Scanner(System.in);
              
              String guess;
              int lo, hi, average;
              lo = 1;
              hi = 1000;
              average = ((lo + hi)/2);
                  
              System.out.println( " Think of a number from 1 to 1000. I'll try to guess it. " );
              System.out.println( " My guess is " + average + " Am I (h)igh, (l)ow, or (c)orrect " );
              guess = keyboard.next();
              
              
              while (guess.equals("h"))
              {
                  hi = average;
                  average = ((lo + hi)/2);
                  System.out.println( " My guess is " + average + " Am I (h)igh, (l)ow, or (c)orrect " );
                  guess = keyboard.next();
              }
              while (guess.equals("l"))
              {
                  lo = average;
                  average = ((lo + hi)/2);
                  System.out.println( " My guess is " + average + " Am I (h)igh, (l)ow, or (c)orrect " );
                  guess = keyboard.next();
              }
              if (guess.equals("c"))
              {
                  System.out.println( " Hurray, I have guessed correctly. " );
              }
          }
      }
    
ALettertoYourself