Assignemnt #68 and ReverseHiLo

Code

///Name: Ben Borglin
///Period: 6
///Program name: Reverse Hi-Lo
///file name: ReverseHiLo.java
///Date Finsihed: 10/22/15

import java.util.Scanner;
import java.util.Random;

public class ReverseHiLo
{
    public static void main(String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        int hi, lo, guess;
        hi = 1000;
        lo = 1;
        guess = (hi + lo) / 2;
        String answer;
        System.out.println("Think of a number between 1-1000 and I will guess it.");
        System.out.println("My guess is " + guess + "? Is it High(h) low(l) or correct(c)");
        System.out.print(">");
        answer = keyboard.next();
        
        while (!"c".equals(answer))
        {
            if (answer.equals("h"))
            {
                hi = guess;
                guess = (hi + lo) / 2;
                System.out.println("My guess is " + guess + "? Is it High(h) low(l) or correct(c)");
                System.out.print(">");
                answer = keyboard.next();
            }
            else if (answer.equals("l"))
            {
                lo = guess;
                guess = (hi + lo) / 2;
                System.out.println("My guess is " + guess + "? Is it High(h) low(l) or correct(c)");
                System.out.print(">");
                answer = keyboard.next();
            }
        }
        
        System.out.println("Sweet I got it right!");

    }
}

        
            
        
        
    

Picture of the output

Assignment 68