Question: In java, 1 . Create a method that will be used to play Guess a Number. This method will receive a String and a Random

In java,
1.Create a method that will be used to play Guess a Number. This method will receive a String and a Random object when called (an object of type Random) and will not return anything. In this method you will: create a new Scanner object, ask the user (using their name) to guess a number from 19 to 47. Randomly generate a number and see if the user got it correct. Let the user know the result.
2. When the user enters 4, back in the main method, call the method created in #
send the user's name and the random object to the method.
3. When the user enters 5, back in the main method, display "Thanks for playing! Please come back again!" Make sure the loop no longer executes.
4. When the user enters any number other than 1-5, Display "Try again...".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!