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.
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff62e04e4-a694-4a8d-8d2e-b227f1dce1e1%2Fd5e003b1-99ac-4de8-8f5b-df63995dd147%2F06pztlj_processed.jpeg&w=3840&q=75)
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):](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff62e04e4-a694-4a8d-8d2e-b227f1dce1e1%2Fd5e003b1-99ac-4de8-8f5b-df63995dd147%2Ffvhvqsa_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education