This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello all, this is my first post of I'm sure what will be many as I'm getting into this game at an "older" age. I am attempting the "number guessing game" that it seems just about everybody has done at one time or another and have just about everything completed (besides "prettying" it up) except the option to play again or exit the game. I've tried a do/while loop, and a while loop but can not get it to work. Obviously the working program would give the user the option to play again, but for trying to figure out where that option should go, I've simply stated that the boolean "gameOver" is false which I feel should reset the game. Any help would be greatly appreciated. Thanks in advance.
For a start be consistent with your formatting. It becomes increasingly difficult to read code and, hence easier to make mistakes, if you aren't consistent with things like indenting, use/placement of curly braces etc.
Also never test if a boolean is equal to true or false or you could make a typing mistake (as you have) and end up assigning a value. For example for booleans you can you use the following to test for true and the following to test for false