Part A: Secret Number Guessing a secret number of the user is one of the most interesting games played around the world. In this part you are required to implement this game in MATLAB that follows the following rules:- • The computer chooses any secret number between given set limits. The user is asked to guess a number until secret number is guessed correctly by the user. At each guess, the computer responds with whether the guess by the user is: Higher than the secret number Equal to the secret number Less than the secret number Also, there are 5 levels in a game where the user is prompted to select any level to play. The levels are as described below:- - Level 1: User has to guess a secret number within range 1-10 Level 2: User has to guess a secret number within range 1-50 Level 3- User has to guess a secret number within range 1-100 Level 4- User has to guess a secret number within range 1-150 Level 5- User has to guess a secret number within range 1-200 Here, the MATLAB will think of a random number between a certain range and ask you to guess it. Important Features of the Game 1. Allow User to guess more than once. 2. Allow the user to play another game once the game is over. 3. Make sure that the number to guess isn't bigger than the maximum range of the level chosen by the user. For example, if a user is playing level 2, then he cannot guess number greater than 50. 4. Give a User hints (like prompting user that the secret number is bigger or smaller than their guess) 5. After finishing the level, a result is displayed to the user along with number of guesses needed by player to guess the secret the secret number and the overall result. 6. Based on the number of guesses and number 'n' in each level, result is displayed to the user. Here, 'n' is maximum number of chosen level, for example, for level 1, n=10, for level 2, n=50, for level 3, n-100, for level 4, n-150 and so on. The other details are as follows: -If number of guesses1, message, “Your Guess is Excellent" is displayed. - If number of guesses between 2 and less than 50% of n, message, "Your guess is good" is displayed. - If number of guesses is equal to 50% of the n, message "Your guess is Average" is displayed. - If number of guesses greater than 50% of n and less than or equal to 80% of n, message "Your guess is Poor" is displayed. -If number of guesses greater than 80% of n, message "You lost the game" is displayed.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Use Matlab please

Part A: Secret Number
Guessing a secret number of the user is one of the most interesting games played around the
world. In this part you are required to implement this game in MATLAB that follows the
following rules:-
• The computer chooses any secret number between given set limits.
• The user is asked to guess a number until secret number is guessed correctly by the user.
At each guess, the computer responds with whether the guess by the user is:
Higher than the secret number
Equal to the secret number
Less than the secret number
Also, there are 5 levels in a game where the user is prompted to select any level to play. The
levels are as described below:-
- Level 1: User has to guess a secret number within range 1-10
Level 2: User has to guess a secret number within range 1-50
Level 3- User has to guess a secret number within range 1-100
Level 4- User has to guess a secret number within range 1-150
Level 5- User has to guess a secret number within range 1-200
Here, the MATLAB will think of a random number between a certain range and ask you to guess
it.
Important Features of the Game
1. Allow User to guess more than once.
2.
Allow the user to play another game once the game is over.
3. Make sure that the number to guess isn't bigger than the maximum range of the level
chosen by the user. For example, if a user is playing level 2, then he cannot guess number
greater than 50,
4. Give a User hints (like prompting user that the secret number is bigger or smaller than
their guess)
5. After finishing the level, a result is displayed to the user along with number of guesses
needed by player to guess the secret number, the secret number and the overall result.
6. Based on the number of guesses and number 'n' in each level, result is displayed to the
user. Here, 'n' is maximum number of chosen level, for example, for level 1, n=10, for
level 2, n=50, for level 3, n=100, for level 4, n=150 and so on. The other details are as
follows:
-If number of guesses =1, message, "Your Guess is Excellent" is displayed.
- If number of guesses between 2 and less than 50% of n, message, "Your guess is good"
is displayed.
- If number of guesses is equal to 50% of the n, message “Your guess is Average" is
displayed.
- If number of guesses greater than 50% of n and less than or equal to 80% of n, message
"Your guess is Poor" is displayed.
-If number of guesses greater than 80% of n, message "You lost the game" is displayed.
“Y
Transcribed Image Text:Part A: Secret Number Guessing a secret number of the user is one of the most interesting games played around the world. In this part you are required to implement this game in MATLAB that follows the following rules:- • The computer chooses any secret number between given set limits. • The user is asked to guess a number until secret number is guessed correctly by the user. At each guess, the computer responds with whether the guess by the user is: Higher than the secret number Equal to the secret number Less than the secret number Also, there are 5 levels in a game where the user is prompted to select any level to play. The levels are as described below:- - Level 1: User has to guess a secret number within range 1-10 Level 2: User has to guess a secret number within range 1-50 Level 3- User has to guess a secret number within range 1-100 Level 4- User has to guess a secret number within range 1-150 Level 5- User has to guess a secret number within range 1-200 Here, the MATLAB will think of a random number between a certain range and ask you to guess it. Important Features of the Game 1. Allow User to guess more than once. 2. Allow the user to play another game once the game is over. 3. Make sure that the number to guess isn't bigger than the maximum range of the level chosen by the user. For example, if a user is playing level 2, then he cannot guess number greater than 50, 4. Give a User hints (like prompting user that the secret number is bigger or smaller than their guess) 5. After finishing the level, a result is displayed to the user along with number of guesses needed by player to guess the secret number, the secret number and the overall result. 6. Based on the number of guesses and number 'n' in each level, result is displayed to the user. Here, 'n' is maximum number of chosen level, for example, for level 1, n=10, for level 2, n=50, for level 3, n=100, for level 4, n=150 and so on. The other details are as follows: -If number of guesses =1, message, "Your Guess is Excellent" is displayed. - If number of guesses between 2 and less than 50% of n, message, "Your guess is good" is displayed. - If number of guesses is equal to 50% of the n, message “Your guess is Average" is displayed. - If number of guesses greater than 50% of n and less than or equal to 80% of n, message "Your guess is Poor" is displayed. -If number of guesses greater than 80% of n, message "You lost the game" is displayed. “Y
The output of the program look like this:
Welcome to the Game: Guess my Secret Number!
Your Name is : Mohamed
Welcome Mohamed
Choose the level of playing:
1) 1-10
2) 1-50
3) 1-100
4) 1-150
5) 1-200
Which level do you want?: 2
Input your guess: 23
Correct! My secret number was: 23
Guesses needed to find my secret number: 1
Your Level to Guess was Excellent
Do you want to play again? (y/n): y
Thanks for playing Mohamed
Choose the level of playing:
1) 1-10
2) 1-50
3) 1-100
4) 1-150
5) 1-200
|Which level do you want?: 3
Input your guess: 34
Lower
Input your guess: 23
Lower
Input your guess: 20
Lower
Input your guess: 12
Lower
Input your guess: 10
Lower
Input your guess: 2
Higher
Input your guess: 3
Higher
Input your guess: 5
Higher
Input your guess: 6
Higher
Input your guess: 7
Higher
Input your guess:
Higher
Input your guess: 8
Higher
Input your guess: 9
Correct! My secret number was: 9
Guesses needed to find my secret number: 13
Your Level to Guess was Good
Do you want to play again? (y/n):
Transcribed Image Text:The output of the program look like this: Welcome to the Game: Guess my Secret Number! Your Name is : Mohamed Welcome Mohamed Choose the level of playing: 1) 1-10 2) 1-50 3) 1-100 4) 1-150 5) 1-200 Which level do you want?: 2 Input your guess: 23 Correct! My secret number was: 23 Guesses needed to find my secret number: 1 Your Level to Guess was Excellent Do you want to play again? (y/n): y Thanks for playing Mohamed Choose the level of playing: 1) 1-10 2) 1-50 3) 1-100 4) 1-150 5) 1-200 |Which level do you want?: 3 Input your guess: 34 Lower Input your guess: 23 Lower Input your guess: 20 Lower Input your guess: 12 Lower Input your guess: 10 Lower Input your guess: 2 Higher Input your guess: 3 Higher Input your guess: 5 Higher Input your guess: 6 Higher Input your guess: 7 Higher Input your guess: Higher Input your guess: 8 Higher Input your guess: 9 Correct! My secret number was: 9 Guesses needed to find my secret number: 13 Your Level to Guess was Good Do you want to play again? (y/n):
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education