This code needs to be written in C#: If the user guesses the number in 3rd try you will assign: Points = (10 – 3)^2/100 = 7 ^ 2 = 49 points. When the user presses the ‘Start Game’ button, the game will start. User will enter a number in the large textbox and press Submit. If number is correct display the Messagebox, else continue with game. Also tell the user if the number entered was higher or lower than actual number. The problem flow will be as follows: 1. Player enters name and number of chances 2. Player presses Start game 3. Computer generates a secret random number 4. Player enters choice 5. Program checks if number matches guesses number. If number matches jump to step #10 6. Program updates message whether the guessed number is more or less than actual 7. Program reduces available chances by 1 and display messages on changes 8. If chances become 0 stop game and tell use Game has ended, and she will have to press ‘Start Game’ again. Same message should be spoken by the program using text to speech. Note that player gets 0 points if she does not win 9. Repeat steps 4-8 10. If user has guessed the number correctly, display a message box that he won the game and total point accumulated by user based on point system above 11. Using Text to Speech, the program also speaks the message that is displayed Make sure your code follows these guidelines (you will lose points if any guideline is not followed):  Display the initial screen with correct layout   The game state should be maintained inside a separate class   The random number generation should be in separate class   The separate class should not have any user interface (MessageBox etc)   Correctly compute the points won by the user   Code should be well commented and indented  Code should compile and run without any error or warnings and should work correctly as per the specifications   Code uses exception handling to handle incorrect input from user   Text to speech works correctly if user wins or loses

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

This code needs to be written in C#:

If the user guesses the number in 3rd try you will assign:
Points = (10 – 3)^2/100 = 7 ^ 2 = 49 points.
When the user presses the ‘Start Game’ button, the game will start. User will enter a number in the large
textbox and press Submit. If number is correct display the Messagebox, else continue with game. Also tell
the user if the number entered was higher or lower than actual number.
The problem flow will be as follows:
1. Player enters name and number of chances
2. Player presses Start game
3. Computer generates a secret random number
4. Player enters choice
5. Program checks if number matches guesses number. If number matches jump to step #10
6. Program updates message whether the guessed number is more or less than actual
7. Program reduces available chances by 1 and display messages on changes
8. If chances become 0 stop game and tell use Game has ended, and she will have to press ‘Start Game’
again. Same message should be spoken by the program using text to speech. Note that player gets 0 points
if she does not win
9. Repeat steps 4-8
10. If user has guessed the number correctly, display a message box that he won the game and total point
accumulated by user based on point system above
11. Using Text to Speech, the program also speaks the message that is displayed
Make sure your code follows these guidelines (you will lose points if any guideline is not followed):
 Display the initial screen with correct layout 
 The game state should be maintained inside a separate class 
 The random number generation should be in separate class 
 The separate class should not have any user interface (MessageBox etc) 
 Correctly compute the points won by the user 
 Code should be well commented and indented
 Code should compile and run without any error or warnings and should work correctly as per
the specifications 
 Code uses exception handling to handle incorrect input from user 
 Text to speech works correctly if user wins or loses 

In this assignment you will make WinForm based guessing game. User will be asked for her name, and
how many chances she wants (max is 10). Then your program will randomly generate a number between 1
and 30 and then ask the user to guess the number in the number of tries defined. If the user guesses correctly,
you will let them know and give them points based on how quickly they guess. The User Interface (UI) of
your program should look similar (but not necessarily same) as:
UHCL Number Guessing Game
Your Name
Number of tries
Start Game
Enter you guess
Submit
Your number was lower than actual
3 chance(s) remaining
Use the following formula to give the points:
Points = (10 – NumberOfTries)^2.
For example if the user guess the number in 1st try you will assign:
Points = (10 – 1)^2/100 = 9 ^2 = 81 points.
-
Transcribed Image Text:In this assignment you will make WinForm based guessing game. User will be asked for her name, and how many chances she wants (max is 10). Then your program will randomly generate a number between 1 and 30 and then ask the user to guess the number in the number of tries defined. If the user guesses correctly, you will let them know and give them points based on how quickly they guess. The User Interface (UI) of your program should look similar (but not necessarily same) as: UHCL Number Guessing Game Your Name Number of tries Start Game Enter you guess Submit Your number was lower than actual 3 chance(s) remaining Use the following formula to give the points: Points = (10 – NumberOfTries)^2. For example if the user guess the number in 1st try you will assign: Points = (10 – 1)^2/100 = 9 ^2 = 81 points. -
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
ListBox
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,