Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you will write the first part of a program that will play a simple Guess the Number game. In the full version

image text in transcribed
image text in transcribed
For this assignment you will write the first part of a program that will play a simple "Guess the Number" game. In the full version of this game (which you will write for this week's project) the program will randomly generate an integer between 1 and 200 inclusive and then will repeatedly ask the user for a guess. If they quess a number that is less than 1 or more than 200 an error message will be printed as a part of this loop. For this lab you will write the piece of the code that checks for this error and ends if the user picks the right number. 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, Note that the code for this lab includes a "debugging" cutput that starts with the word 'DEBUG; " that tells you the number that was randomly chosen. In the full version of this program that will be removed, but for this incremental piece your lab submission should include it. (You should get used to having this kind of debugging output in your code that isnt part of the final program but is crucial to ensuring that each incremental piece is working properly before you move onto the next part of the program). 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 randon seed: 99 DEEUG: The nunber picked is: 188 Enter a suess betveen 1 and 200:259 Your guess is out of range. Pick a number betveen 1 and 200 . That is not the muber. Enter a guess betveen 1 and 200:1 Your guess is out of range. Pick a number betreen 1 and 200. That is not the muber. Enter a guess betveen 1 and 200: 88 That is not the muber. Enter a guess betveen 1 and 200:188 Congratulations I Pour guess vas correct I had chosen 188 as the target number. Your guessed it in 4 tries. Random numbers: Just like in the FunWithBranching programming assignment, you must use the Randon class to generate numbers between 1 and 200. Make sure you are using int values and not doubles for this assignment! Look back at your submitted code for that Random numbers: Just like in the FunWithBranching programming assignment, you must use the Randon class to generate numbers between 1 and 200. Make sure you are using int values and not doubles for this assignment! Look back at your submitted code for that project and reuse what you can here - reusing code from old assignments isnt only allowed, it's ENCOURAGED! If you've solved a problem once you should remind yourself how you solved it when asked to do something similar! 217 Load default template.. When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

1. How can evolutionary theory explain prosocial behaviour?

Answered: 1 week ago