Question: Write a hangman game that randomly generates a word and prompts the user to guess one letter at a time, as shown in the sample

Write a hangman game that randomly generates a word and prompts the user to guess one letter at a time, as shown in the sample run. Each letter in the word is displayed as an asterisk. When the user makes a correct guess, the actual letter is then displayed. When the user finishes a word, display the number of misses and ask the user whether to continue to play with another word. Declare an array to store words, as follows:// Add any words you wish in this arrayString[] words = {"write",?"that", ...};(Guess) Enter a letter in word ******* (Guess) Enter a letter in

(Guess) Enter a letter in word ******* (Guess) Enter a letter in word p****** > r (Guess) Enter a letter in word pr**p** > p p is already in the word (Guess) Enter a letter in word pr**r** > o JEnter -Enter -Enter JEnter (Guess) Enter a letter in word pro*r** > g JEnter (Guess) Enter a letter in word progr** > n JEnter n is not in the word (Guess) Enter a letter in word progr** > m (Guess) Enter a letter in word progr*m > a The word is program. You missed 1 time Do you want to guess another word? Enter y or n> Enter -Enter

Step by Step Solution

3.31 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program Plan Import the required classes Create the class called Hangman o Start the main method of ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!