Modify the program you wrote for homework #10 so that it
is designed in modular fashion using methods. In particular you will
write three methods (in addition to main()) as explained below:
- Write a method that will have the user enter a guess in the range
1 to 100. The method should use a loop to validate the user input
and should return the value they enter.
- Write a similar method that will have the user enter “y” or
“n”. The method should return the value they enter but should
use a loop to require re-entry until one of those two values has
been specified.
- Write a method that will actually play the game. This includes
selecting the hidden number and a loop of user guesses.
When you have finished the program, main() should look something like this:
do {
call method to play the game
ans= call method to see if they want to play again
} while (ans is "y");