Question: using MATLab Problem 2 Write a program that implements a simple number guessing game. The script should first generate a random number with two significant

using MATLab Problem 2 Write a program that implements a simple numberusing MATLab

Problem 2 Write a program that implements a simple number guessing game. The script should first generate a random number with two significant decimal places that is in the range of -10 to 10 (use the functions rand() and round ( to do this). Next, the player must be given the chance to guess at the correct number, with their guess being rounded to two decimal places. If the user guesses a number greater than 10, their guess should be set to 10, whereas if they guess a number less than -10, their guess should be set to -10. After the player has made their guess, the program should indicate how close the guess is to being correct. The responses that the program should give are as follows: "You won if the exact correct number is guessed You were incredibly close if the guess is within 0.05 of the correct number You were very close if the guess is between 0.05 and 0.1 away from the correct number You were close if the guess is between 0.1 and 0.5 away from the correct number "You were kind of close if the guess is between 0.5 and 1 away from the correct number You were at least in the ballpark if the guess is between 1 and 2 away from the correct number "You were not close if the guess is between 2 and 5 away from the correct number "You were way off if the guess is further than 5 away from the correct number The program must allow the user to keep guessing until they eventually guess the correct number. This can be accomplished through the use of a while() loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!