title: Stuck on a java assignment, binary search algorithm
body: <p>I have hit this point on an assignment and I was hoping for some guidance.  Basically the program is supposed to have a user think of a number between 1-100 and then ask if it is higher or lower than 50.  Then the program outputs the midpoint until of the range until the answer is correct.  For example if 'h' was entered it would then ask if the number is 75, if the response is then 'l' it would ask if the number is 67, etc.  </p>
  
  <p>I think I have built the framework but I am really struggling with how to approach the next step in finding the midpoint.  Any guidance would be greatly appreciated. </p>
  
  <pre><code>import java.util.Scanner;
  
  public class numberguess 
  {
  
      public static void main(String[] args) 
      {    
          String shouldPlayAgain = "y";
          String response = "h";
  
          Scanner keyboard = new Scanner(System.in);
  
          do
              {
                  System.out.println("Guess a number between 1 and 100.");
                  System.out.print("Is it 50? (h/l/c): ");
                  response = keyboard.nextLine();
  
                      if (response.equals("h"))
                          {
                              System.out.println("Is it 75? (h/l/c): ");
                          }
  
                      if (response.equals("l"))
                          {
                              System.out.println("Is it 25? (h/l/c): ");
                          }
  
                  System.out.print("Great! Do you want to play again? (y/n): ");
                  shouldPlayAgain = keyboard.nextLine();
              }
          while (shouldPlayAgain.equals("y"));
          }
  }       
  </code></pre>