• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java guessing game  RSS feed

 
Geralt Rivea
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone i made  a java guessing game where the where the user is asked to guess a secret number into an input box.

When the user enters the number there are 3 possibilitys which can be seen below in the code. How do i get the program to keep running until the correct answer is guessed while helping the user by stating it's to high or to low. And I have to use a sentinel controlled loop(while loop).

Here's the code:

 
Cor Zwart
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean something like this?

 
Geralt Rivea
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cor Zwart wrote:Do you mean something like this?


Basically when user inputs a number less  then 23 it goes to the second loop and when the user inputs again
This time a number greater than 23 its unable to go back to the first loop because it's already past.
 
Cor Zwart
Greenhorn
Posts: 4
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint:

 
Geralt Rivea
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cor Zwart wrote:Hint:


Thanks so much for your help its much appreciated!
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cor Zwart, welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!