If you are not sure where to get started then try following these steps.
Do no proceed to the “next” step until you have finished the one before
it. If you get stuck then get help ... but make sure that you are
the problem-solver behind each statement!
Create and test a method that has the user enter a guess in
the range 1 to 100. The method should return the value entered
by the user.
Create and test a method that has the user enter a “y” or an
“n” and validates the input. The method should return the value entered
by the user.
The program that houses these two programs can be temporarily “set
aside” as you continue these steps.
Make a copy of your most recent working guessing game program.
Fix any indentation/documentation shortcomings in the program.
Move the code that actually plays the game into a new method.
Be sure to move necessary variable declarations with it. Then
call that method from main. Compile and test!
Take some time to look at each variable you've declared. Remove
any unncessary variables.
Copy and paste the methods you wrote in the first steps into
this program. Compile to make sure that the methods are in the
correct location. (You won't even be using them at this point.)
Modify the program so that it calls each of the methods when
appropriate. Compile and test.
Make sure all indentation and documentation is up to spec. Compile
and test.