Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and code the program to display the input and output for the Hangman prog

ID: 671716 • Letter: D

Question

Design and code the program to display the input and output for the Hangman program. Use your last name as the word to guess. Each letter will be a char data type. Start by having the user enter 5 letters to guess. See below:

Conditional Statements

Then modify the design and program to test if each letter the user entered is one of the letters in the word. If the letter guessed is in the word, display a message to the user that they guessed correctly, if not display a message that the user guessed incorrectly. Add a score variable that will keep track of the number of incorrect guesses. If the user guesses incorrectly, increment the score variable. Display the score at the end of the program.

Please include the C# code used.

Explanation / Answer

using System; using System.Linq; using System.Text; namespace Hangman { /// /// Manages the guesses of player. /// public class GuessCharacterHandler : GameLogic { /// /// Initializes a new instance of the class. /// public GuessCharacterHandler() // used to be GuessRanderer : base() { } /// /// Shows the word after the player's guess. /// If the player guessed correctly then the correct letter in the word is revealed. /// Else the number of player's mistakes is increased by 1. /// /// Word to be guessed by player. /// Char entered by player. public void HandleUserGuess(string word, char charSupposed) { int supposedCharCounter = 0; if (RevealedChars.Contains(charSupposed)) { Console.WriteLine("You have already revelaed the letter {0}.", charSupposed); return; } for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote