Your task is to implement a number guesser that works on the principle of a binary search. In each step, the guesser cuts the query interval in half. When the interval contains a single number, it proclaims the answer.

Suppose your guesser is asked to guess a number between 1 and 100. It starts with the query

>50

50 is the midpoint between 1 and 100.

The person who knows the number says false. The next query is

>25

25 is the midpoint between 1 and 50.

The answer is still false, and the next query is

>13

The answer is still false, and the next query is

>7

Now the answer is true, and the next query is

>10

The answer is again true, and the next query is

>12

The answer is once again true, and now the guesser proclaims

=13

An object of your class will be called like this:

while (...)
{
   String guess = guesser.nextGuess();
   if (guess.startsWith("="))
   {
      // display answer and terminate loop
      ...
   }
   else
   { 
      // show guess to person who knows the answer
      ...
      // get response from person
      boolean resp = ...; 
      guesser.response(resp);
   }
}