Question: Write the MATLAB code to create a guessing game. Your code must do all or the following: a. Prompt the user for their choice of

 Write the MATLAB code to create a guessing game. Your code

Write the MATLAB code to create a guessing game. Your code must do all or the following: a. Prompt the user for their choice of upper bound (largest positive integer). Continue prompting until the user provides a valid value. b. Randomly generate a target integer (the number to be guessed) between -10 and the user's choice of upper bound. c. Embed the user's upper bound in the "guess" prompt. d. Keep track of number of guesses and report that number after the guess is correct. e. Use variable names that suggest their meaning. Here is a sample run of the game: Welcome to my Guessing Game! The smallest integer will be -10. What shall I set for the largest positive integer? 1.7 Sorry, we need a positive integer: -3 Sorry, we need a positive integer: 15 Okay, let's begin: Guess an integer between -10 and 15: 3 Too small! Guess an integer between -10 and 15: 14 Too big! Guess an integer between -10 and 15: 12 Too big! Guess an integer between -10 and 15: 10 Correct! It took you 4 guesses

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!