Assignemnt #68 Reverse Hi-Lo

Code

   
    /// Name: Jake Johnson
    /// Period: 7
    /// Program Name: ReverseHiLo
    /// File Name: ReverseHiLo.java
    /// Date Finished: 12/10/2015
    
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 guess = (hi + lo)/2;
            
        System.out.println("Think of a number from 1-1000. I'll try to guess it.");
        System.out.println("My guess is " + guess + " . Am I too (h)igh, too (l)ow, or (c)orrect?");
        String a = keyboard.nextLine();
        
        while (!a.equals("c"))
        {
            if (a.equals("h"))
            {
                hi = guess;
                guess = (hi + lo)/2;
                System.out.println("My guess is " + guess + " . Am I too (h)igh, too (l)ow, or (c)orrect?");
                a = keyboard.next();
            }
            else if (a.equals("l"))
            {
                lo = guess;
                guess = (hi + lo)/2;
                System.out.println("My guess is " + guess + " . Am I too (h)igh, too (l)ow, or (c)orrect?");
                a = keyboard.next();
                
            }
        }
        System.out.println("\nWooHOOO!!! I was right!");
    }
}

    

Picture of the output

This should work