Question: Consider a class that could be used to play a game of hangman. The class has the following attributes: The secret word The disguised word,
Consider a class that could be used to play a game of hangman. The class has the following attributes:
The secret word
The disguised word, in which each unknown letter in the secret word has been replaced with a question mark (?). For example, if the secret word is abracadabra and the letters a, b and e have been guessed, the disguised word would be ab?a?a?a?ab?a.
The number of guesses made.
The number of incorrect guesses. The class would have the following methods:
makeGuess(char c) guesses that character c is in the word. getDisguisedWord() returns a String containing correctly guessed letters in the correct positions and unknown letters replaced with ?.
getSecretWord() returns the secret word.
getGuessCount() returns the number of guesses made.
isFound() returns true if the hidden word has been discovered.
Your task is to implement the class with the above variables and methods, then implement a game of hangman using this class. Your program doenst need to draw anything.
please use JAVA to help me solve this question with the code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
