Answered You can hire a professional tutor to get the answer.

QUESTION

I need a JAVA program which will allow a user to play a simplified version of the hangman game. The program will display the secret word in its

I need a JAVA program which will allow a user to play a simplified version of the hangman game. The program will display the secret word in its disguised form (a row of question marks (?), and invite the user to enter an alphabetic letter. If the letter occurs in the secret word, the program will display it in all its correct positions and ask the user to enter another letter as a guess. The process continues until the user guesses the word correctly! The program will also display a running total of the number of guesses made and the number of wrong guesses.

I need two classes for this program - a class that could be used to play a simplified version of the hangman game (as described in the above paragraph) and a client class that uses the hangman class. Provide the UML class diagram for the hangman class.

The hangman class will have at least the following attributes:

• The secret word or phrase (a String, which may include embedded white spaces and punctuation characters)

• The disguised word, in which each unknown alphabetic letter in the secret word is replaced with a question mark (?). When an unknown letter is guessed correctly, it will replace the corresponding question mark(s) in the disguised word. For example, if the secret word is abracadabra and the letters a and b have been guessed, the disguised word would be ab?a?a?ab?a.

• The number of guesses made.

• The number of incorrect guesses.

The hangman class will have at least the following methods:

• makeGuess(ch) guesses that character ch is in the word.

• getDisguisedWord returns a String containing correctly guessed letters in their 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.

I need a client class that tests the hangman class. The client class should allow the user to play three games of hangman. The client class will have the three secret words (or phrases) built into it as String variables. The client class only needs to have the main method which creates an object of the hangman class, sets the secret word and passes control to the hangman class.

I need to this program to work without any arrays.

I'm having trouble with the java code I need help. This is for my understanding I won't submit tutors work, besides this is just a lab.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question