Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions