Programming Exercise 7.35 presents a console version of the popular hangman game. Write a GUI program that

Question:

Programming Exercise 7.35 presents a console version of the popular hangman game. Write a GUI program that lets a user play the game. The user guesses a word by entering one letter at a time, as shown in Figure 20.18. If the user misses seven times, a hanging man swings. Once a word is finished, the user can press the Enter key to continue to guess another word.

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 array

String[] words = {"write",?"that", ...};

image

image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: