Write a "Guess My Number Game" program. The program generates a random integer in a specified range, and the user (the player) has to guess the number. The program allows the use to play as many times as he/she would like; at the conclusion of each game, the program asks whether the player wants to play again. The basic algorithm is: 1. The program starts by printing instructions on the screen. 2. For every game: ▸ the program generates a new random integer in the range from MIN to MAX. Treat MIN and MAX like constants; start by initializing them to 1 and 100 ► loop to prompt the player for a guess until the player correctly guesses the integer for each guess, the program prints whether the player's guess was too low, too high, or correct at the conclusion (when the integer has been guessed): ➤ print the total number of guesses for that game print a message regarding how well the player did in that game (e.g., the player took way too long to guess the number, the player was awesome, etc.). To do this, you will have to decide on ranges for your messages and give a rationale for your decision in a comment in the program. 3. After all games have been played, print a summary showing the average number of guesses.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 3GZ
icon
Related questions
Question
Write a "Guess My Number Game" program. The program generates a random integer in a specified range,
and the user (the player) has to guess the number. The program allows the use to play as many times as
he/she would like; at the conclusion of each game, the program asks whether the player wants to play
again.
The basic algorithm is:
1. The program starts by printing instructions on the screen.
2. For every game:
the program generates a new random integer in the range from MIN to MAX. Treat MIN and MAX
like constants; start by initializing them to 1 and 100
► loop to prompt the player for a guess until the player correctly guesses the integer
for each guess, the program prints whether the player's guess was too low, too high, or correct
at the conclusion (when the integer has been guessed):
➤ print the total number of guesses for that game
print a message regarding how well the player did in that game (e.g., the player took way too
long to guess the number, the player was awesome, etc.). To do this, you will have to decide on
ranges for your messages and give a rationale for your decision in a comment in the program.
3. After all games have been played, print a summary showing the average number of guesses.
Transcribed Image Text:Write a "Guess My Number Game" program. The program generates a random integer in a specified range, and the user (the player) has to guess the number. The program allows the use to play as many times as he/she would like; at the conclusion of each game, the program asks whether the player wants to play again. The basic algorithm is: 1. The program starts by printing instructions on the screen. 2. For every game: the program generates a new random integer in the range from MIN to MAX. Treat MIN and MAX like constants; start by initializing them to 1 and 100 ► loop to prompt the player for a guess until the player correctly guesses the integer for each guess, the program prints whether the player's guess was too low, too high, or correct at the conclusion (when the integer has been guessed): ➤ print the total number of guesses for that game print a message regarding how well the player did in that game (e.g., the player took way too long to guess the number, the player was awesome, etc.). To do this, you will have to decide on ranges for your messages and give a rationale for your decision in a comment in the program. 3. After all games have been played, print a summary showing the average number of guesses.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr