Question: C# Create a Console Application that plays guess the number as follows: 1. Your app chooses the number to be guessed by selecting a random

C#

Create a Console Application that plays guess the number as follows:

1. Your app chooses the number to be guessed by selecting a random integer in the range 1 to 1000.

1.1. If you are comfortable getting a random integer, you can use the code new Random().Next(1, 1001);

1.2. Otherwise, you can always hard-code the correct number in your computer so that every time when the person plays the game, the number will be fixed.

2. The app displays the prompt Guess a number between 1 and 1000.

3. The player inputs a first guess.

4. If the player's guess is incorrect, your app should display either

4.1. Too high. Try again. or

4.2. Too low. Try again. to help the player zero in on the correct answer.

5. The app should prompt the user for the next guess.

6. When the user enters the correct answer, display Congratulations. You guessed the number!

7. and allow the user to choose whether to play again.

8. In addition,

8.1. If the number of tries is 10 or fewer: display Either you know the secret, or you got lucky!

8.2. If the player guesses the number in 10 tries, display Aha! You know the secret!

8.3. If the player makes more than 10 guesses, display You should be able to do better!

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!