Reverse Random Number Game
I'm new to java, and need to write a program where the program asks the user to think of a number between 1 and 10, and then the programs generates random guesses until the user confirms with y that the number is correct, and then displays the results, including number of attempts.
I'm using a counter, I know how to print introduction and results. I'm having a problem though. I need to create a method that takes a prompt String and a Scanner as input and returns a char. If kb was the scanner object, the call would be:
char ans = promptYN("Do you want to play against", kb)
Re: Reverse Random Number Game
What specifically is your problem? Do you know how to declare and implement a method? Do you know how to get user input using a Scanner object? Do you know how to convert a string input from the Scanner into a single char output? Do you know how to return values? Or does your problem lie elsewhere?
Re: Reverse Random Number Game