I am beginner in java. Please provide a sample program in Java to play a number-guessing game. The game works as follows:

The user chooses a number in his mind and types “ready” to indicate to the computer that he is ready to 

begin playing.

The computer asks a series of questions to arrive at the number the user has in mind. The user can only 

respond with “higher”, “lower” or “yes”.

The game ends when the user responds with “yes” or “end”.

Example:

User chooses number 40 in his mind.

Computer: Is the number 30?

User: higher

Computer: Is the number 50?

User: lower

Computer: Is the number 35?

User: higher

Computer: Is the number 40?

User: yes