Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Guess Number Close G Google Password Required Enter your password for larein01022 in Internet Accounts My library > CSE 1223: Introduction to Computer Programming in

image text in transcribed
image text in transcribed
image text in transcribed
Guess Number Close G Google Password Required Enter your password for larein01022" in Internet Accounts My library > CSE 1223: Introduction to Computer Programming in Java home > - zyBooks Continu zyBooks 11.7. Guess A Number Students: Section 11.7 is a part of 1 assignment: Project 04 - Guess A Number Requirements: zyLab Entire class due: 02/10/2020, 11:30 PM EST 11.7 Guess A Number For this assignment you will write a Java program using a loop that will play a simple Guess The Number game. Create a new project named GuessANumber and create a new Java class in that project named GuessANumber.java for this assignment The program will randomly generate an integer between 1 and 200 (including both 1 and 200 as possible choices) and will enter a loop where it will prompt the user for a guess. If the user has guessed the correct number, the program will end with a message indicating how many guesses it took to get the right answer and a message that is determined by how many guesses it takes them to get the right answer. If the user guesses incorrectly, the program should respond with a message that the user has guessed either too high' or too low and let them guess again Use the following table to determine the final message after the score is computed (note that your code MUST respond with these messages to be considered correct): Number of Guesses Message 2-3 4-7 That was impossible! You're pretty lucky! Not bad, not bad... That was not very impressive. Are you having any fun at all? Maybe you should play something else. 9-10 11 or more learnybooks.com = zvBooks My library > CSE 1223: Introduction to Computer Programming in Java home > 11.7: Guess A Number G Google Password Required Enter your password for "arena010228 innet Accounts E zyBooks c 11 or more Maybe you should play something else. Sample Output This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program. Enter a random seed: 99 Enter a guess between 1 and 200: 100 Your guess was too low - try again. Enter a guess between 1 and 200: 150 Your guess was too low - try again. Enter a guess between 1 and 200: 175 Your guess was too low - try again. Enter a guess between 1 and 200: 187 Your guess was too low - try again. Enter a guess between 1 and 200: 193 Your guess was too high - try again. Enter a guess between 1 and 200: 190 Your guess was too high - try again. Enter a guess between 1 and 200: 188 Congratulations! Your guess was correct! I had chosen 188 as the target number. You quessed it in 7 tries. Not bad, not bad... learn.zybooks.com Guess a Number 11.7. O ss A Number = zyBooks My library > CSE 1223: Introduction to Computer Programming in Java home > 11.7: Guess A Number zyBooks catalog Help/FAQ Your code will behave differently based on the random value it selects and the choice taken by the user. Here is a second possible execution of this code: Wanyue Zhan Enter a random seed: 1024 Enter a guess between 1 and 200: 120 Your guess was too low - try again. Enter a guess between 1 and 200: 130 Your guess was too high - try again. Enter a guess between 1 and 200: 124 Congratulations! Your guess was correct! I had chosen 124 as the target number. You guessed it in 3 tries. You're pretty lucky! If the user enters an invalid choice, your code should inform them that their choice was invalid and ask them to guess again. Enter a random seed: 99 Enter a guess between 1 and 200: 259 Your guess is out of range. Pick a number between 1 and 200. Your guess was too high - try again. Enter a guess between 1 and 200: -1 Your guess is out of range. Pick a number between 1 and 200. Your guess was too low - try again. Enter a guess between 1 and 200: 188 Congratulations! Your guess was correct! Thad chosen 198 the taceat number

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago