You should not call guessNumber() more then once. Every time you call guessNumber() you get a new number.

Instead you will save the the value in an variable and use it. Like:



int number =...