Java exercise: Guessing Game

Practicing your craft is very important part of being a developer. Using Java, you need to create a guessing game where the computer will think of a random number between 1-100, and the player gets 10 turns to guess the number.

You will need to ask the user for input, and also you will need the computer to generate a random number. You need to limit the player`s turns to 10. If the player is successful in guessing the number, you can declare a winner and the game will end.  If the player does not succeed in guessing the number, the game will end, and you need to tell the player what number was the computer thinking of.

Try it out. If you are stuck, scroll down for a solution.

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|

 

 

 

You have a better solution, fell free to share it with everyone.

Happy coding!

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *