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

QUESTION

Hangman is a game that can be played between two players. One player thinks of a word and the other tries to guess it by suggesting letters.

Hangman is a game that can be played between two players. One player thinks of a word and the other tries to guess it by suggesting letters. The word to guess is represented by a row of dashes, giving the number of letters in the word. If the guessing player suggests a letter which occurs in the word, the other player writes it in all its correct positions. See http://en.wikipedia.org/wiki/Hangman_(game) for further details).

Design, write in Java, test and document a 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.

Design 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.

Devise any additional methods and attributes that are needed in the class and are not listed above. Note that when treating letters of the alphabet, case is not important (i.e., the uppercase and lowercase forms of the same letter are to be treated the same). 

Write 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. Note that 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.

Do not use arrays in this program. The test results from the program should be submitted as part of your external documentation

Your program should also include a method (eg, StudentInfo( )) to output your student details (name, student number, mode of enrolment, tutor name, tutorial attendance day and time) at the start of program output. 

I'm having trouble with the java code I need help. I just need the hangman java code thanks.

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