Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE INCLUDE PSEUDOCODE PLEASE INCLUDE PSEUDOCODE Details: Create a class called GuessTheNumber that generates a random magic number between 1 and 10 inclusive. It will

PLEASE INCLUDE PSEUDOCODE

image text in transcribed

PLEASE INCLUDE PSEUDOCODE

Details: Create a class called GuessTheNumber that generates a random magic number between 1 and 10 inclusive. It will then ask the user to guess the magic number, and display one of the following messages: Your guess is too high Your guess is too low You guessed correctly in nn guesses! If the user guesses incorrectly, indicate if the guess is too high or too low, and continue asking for a guess until the user guesses the magic number. The class should count the number of guesses it took the user, and display that value for nn. The class should have at least the following two methods: public void play() - Which plays the game. The method should create the magic number the user is trying to guess. It should call the askForGuess method to obtain the user's guess and then check if the user guessed the magic number. If the user didn't guess the magic number this method should display to the user if the guess was too high or too low, and then ask for a new guess. When the user finally guess the magic number, it should display to the user that they guessed the correct number and indicate how many guesses it took. private int askForGuess () - Which asks the user for their guess. This method should check that the user's guess is between 1 and 10 inclusive, and if it is, return the guess. If the user's guess is not within range, the method should indicate the user's guess was out of range and continue asking for a guess. Create a second class called GuessTheNumberTest that contains the main method. The method should create a GuessTheNumber object and call the play method. The class should play the game at least once, and then ask the user if they would like to play the game again. Keep playing the game until the user decides they want to stop

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago