Write a MatLab program in which the guessing game from below is modified to allow the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a MatLab program in which the guessing game from below is modified to allow the user to guess up to 4 times. If the number wasn't guessed correctly after the 4 tries, tell the user what the correct number was, then ask if they want to play again. Add the ability for the user to quit the program by inputting a "q" or a "0." At that point, print out the number of wins/losses of the game. Number guessing game. Write a program, guessing.m, that does the following: The computer generates a random integer between 1 and 20 (inclusive). The computer displays "I am thinking of a number between 1 and 20." It prompts the user to input a guess. While the guess is not equal to the computer's number, it tells the user whether the guess was too low or too high, and prompts for another guess. When the user guesses the right number, the computer congratulates the user and ends the game. (Hint: Use a while loop.) A run of the program (for which the user guessed 10 and 15 before correctly guessing 13) might look something like this: >> guessing I am thinking of a number between 1 and 20. Enter your guess: 10 Too low Enter your guess: 15 Too high Enter your guess: 13 Right! Write a MatLab program in which the guessing game from below is modified to allow the user to guess up to 4 times. If the number wasn't guessed correctly after the 4 tries, tell the user what the correct number was, then ask if they want to play again. Add the ability for the user to quit the program by inputting a "q" or a "0." At that point, print out the number of wins/losses of the game. Number guessing game. Write a program, guessing.m, that does the following: The computer generates a random integer between 1 and 20 (inclusive). The computer displays "I am thinking of a number between 1 and 20." It prompts the user to input a guess. While the guess is not equal to the computer's number, it tells the user whether the guess was too low or too high, and prompts for another guess. When the user guesses the right number, the computer congratulates the user and ends the game. (Hint: Use a while loop.) A run of the program (for which the user guessed 10 and 15 before correctly guessing 13) might look something like this: >> guessing I am thinking of a number between 1 and 20. Enter your guess: 10 Too low Enter your guess: 15 Too high Enter your guess: 13 Right!
Expert Answer:
Answer rating: 100% (QA)
Certainly Below is an example MATLAB script that could be used for the number guessing game mentione... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The number of dwelling units or buildings per unit of land is called: Group of answer choices Density Floor-area ratio Setback Building coverage
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Angelo Bank is planning to replace some old ATM machines and has decided to use the York Machine. Anita Chavez, the controller, has prepared the analysis shown here. She has recommended the purchase...
-
A bottle contains a label stating that it contains Spring Valley pills with 500 mg of vitamin C, and another bottle contains a label stating that it contains Bayer pills with 325 mg of aspirin. When...
-
A USA Today editorial (Alejandro Gonzalez, CEO Dough) addressed the growth of compensation for corporate CEOs. Part of the story quoted a study done for BusinessWeek , which indicated that the pay...
-
What type of survivorship curve characterizes humans? What other characteristics are associated with this type of survivorship curve? Do humans show many of these other characteristics?
-
Billie Bradford worked for the Kentucky Department of Community Based Services (DCBS). One of Bradfords co- workers, Lisa Stander, routinely engaged in extreme sexual behavior (such as touching...
-
A property is leased for $100 NNN (triple net) with no rent increases for 50 years. However the owner of this asset is liable for a sizable TI $ and broker's fees $110 due in year 6. If you are...
-
The electric potential at points on the xy plane is given by V=(2.0x^2 - 5.0y^2) where x and y are in meters and V is in volts. What is the electric field in unit vector notation at the point (2.0 m,...
-
Initiating and implementing social determinants of health data collection in community health centers Links to an external site.. Population Health Management , https://doi.org/10.1089/pop.2019.0205...
-
Explain; Literature matters because it is timeless. Literature matters because it is universal. Literature matters because it is transcendent. Literature matters because it teaches and entertains....
-
A 2.5 kg block collides with a horizontal spring of negligible mass and spring constant of 320 N/m. The block compresses the spring by 8.5 cm from its rest position. The kinetic frictional force...
-
Signature Assignment: Personal Renaissance Description and Writing Prompt The Renaissance, as we learned in the course, represented a rebirth of knowledge and culture, as well as new ways of...
-
Budget Analysis GWhen evaluating a fiscal year budget, what do you find to be the most important (i.e. Funds, Debt, Capital, Revenue to Expenses, etc.)? Once determined, what is the selected entity's...
-
On September 1, 2020 WayTooBig (WTB) Company decided it would sell off its LargerThanLarge (LTL) division. The division qualifies as a component of the organization. Disposal of the LTL division will...
-
on 8 For the following set of lengths 130, 170, 160, 160, 150, 190 Third quartile is: et red d out of Select one: O a. 160 a question O b. 145 O c. 175 O d. 180
-
Make a polar plot of the function r = 2sin(3)sin for 0 < < 2.
-
Write a program in a script file that converts a measure of pressure given in units of either Pa, psi, atm. or torr to the equivalent quantity in different units specified by the user. The program...
-
Create the following matrix by using vector notation for creating vectors with constant spacing and/or the linspace command. Do not type individual elements explicitly. 130 110 90 70 50 30 10 A 1...
-
Which ETF in Exhibit 1 is most likely to have the lowest tracking error? A. ETF 2 B. ETF 3 C. ETF 4 Howie Rutledge is a senior portfolio strategist for an endowment fund. Rutledge meets with recently...
-
Stosurs statement about quoted bidask spreads is incorrect with respect to the: A. amount of the ongoing order flow in the ETF. B. costs and risks for the ETF liquidity providers. C. amount of...
-
Which ETF in Exhibit 2 is most likely to trade at the largest premium or discount relative to NAV? A. ETF 5 B. ETF 6 C. ETF 7 Howie Rutledge is a senior portfolio strategist for an endowment fund....
Study smarter with the SolutionInn App