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
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.
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
Trending now
This is a popular solution!
Step by step
Solved in 5 steps