Assignemnt #68 Reverse Hi Lo

Code

    ///Name: Joshua Pell
    ///Period: 6
    ///Project Name: Reverse Hi Lo
    ///File Name: OpHiLo.java
    ///Date: 1/15/2015
    
 import java.util.Scanner;
    public class OpHiLo
    {
        public static void main( String [] args)
        {
            Scanner key = new Scanner(System.in);
            System.out.println("Think of a Number 1-100?");
            System.out.println("my guess is 500. Am I Too (h)igh, too (l)ow, or (c)orrect?");
            String d2 = key.next();
            int lo=1, hi=1000,n=500;
    		while (!d2.equals("c"))
            {
                if (d2.equals("h"))
                {
                    hi = n;
                    n = ( lo + hi ) / 2;
                    System.out.println("my guess is "+n+". Am I Too (h)igh, too (l)ow, or (c)orrect?");
                    d2 = key.next();
                }
                
                else if (d2.equals("l"))
                {
                    lo = n;
                    n = ( lo + hi ) / 2;
                    System.out.println("my guess is "+n+". Am I Too (h)igh, too (l)ow, or (c)orrect?");
                    d2 = key.next();
                }
    		}
        }
    }
    

Picture of the output

Assignment 68