Microsoft Visual C#
Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
Question
Book Icon
Chapter 6, Problem 10E
Program Plan Intro

Program plan:

  • Create a class Program under namespace GuessAWord.
  • Declare two variables wrongGuessChance and lettersLeft of type int.
  • Define the following functions inside the class:
    • Define a function getGuessWord: This function store eight words in array words and use Random class to pick a random word from this array and return it.
    • Define a function hideWord: This function takes as input the randomly selected word and masks it by using asterisks.
    • Define a function DisplayCharacters: This function displays the remaining unguessed letters of the guessing word.
    • Define a function testGuess: This function takes the userLetter, word and characters array as a parameter. This function then uses for loop to check if the userLetter matches with any of the letters of guessWord. If yes it changes the masked guessWord, else it displays the message for the wrong guess and reduces the guessing chances.
    • Define main functions and call the above functions in order to generate the guessing game.

Program Description: The following program will create a word guessing game named as GuessAWord.

Blurred answer
Students have asked these similar questions
Create a game similar to Hangman named GuessAWord in which a player guessesletters to try to replicate a hidden word. Store at least eight words in an array, andrandomly select one to be the hidden word. (The statements needed to generate arandom number are shown in the Exercises in the “Decision Making” and “Looping”chapters.) Initially, display the hidden word using asterisks to represent each letter.Allow the user to guess letters to replace the asterisks in the hidden word until theuser completes the entire word. If the user guesses a letter that is not in the hiddenword, display an appropriate message. If the user guesses a letter that appears multipletimes in the hidden word, make sure that each correct letter is placed. Figure 6-27shows typical games in progress in a console-based application and in a GUIapplication. In the GUI application, the user has successfully guessed e, and is about toguess r. Hint: If you create the GUI version of the game, you might want to include…
Write an application that stores the following nine integers in an array: 10, 15, 19, 23, 26, 29, 31, 34, 38. Display the integers from first to last, and then display the integers from last to first.
Increasing the value of the length property adds more items to an array, but the items have null values until they are defined.  True or False
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT