Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

a. In Chapters 7 and 8, you created a game named Secret Phrase in which the user guesses a randomly selected secret phrase by entering one letter at a time. Now create a GUI application that plays the...

1 answer below »
a. In Chapters 7 and 8, you created a game named Secret Phrase in which the user guesses a randomly selected secret phrase by entering one letter at a time. Now create a GUI application that plays the game, allowing users to choose a letter by selecting one of 26 buttons. (Hint: Consider creating an array of buttons rather than 26 individually named buttons.) Disable a letter button once it has been guessed, and after the puzzle is complete, disable all the letters. Figure 16-39 shows a typical execution (1) after the user has guessed an A, which is in the phrase; (2) after the user has guessed a D, which is not in the phrase; and (3) after the user has completed the puzzle. Save the file as JSecretPhrase.java. b. Make the JSecretPhrase game more like the traditional letter-guessing game Hangman by drawing a “hanged” person piece by piece with each missed letter. For example, when the user chooses a correct letter, place it in the appropriate position or positions in the phrase, but the first time the user chooses a letter that is not in the target phrase, draw a head for the “hanged” man. The second time the user makes an incorrect guess, add a torso. Continue with arms and legs. If the complete body is drawn before the user has guessed all the letters in the phrase, display a message indicating that the player has lost the game. If the user completes the phrase before all the body parts are drawn, display a message that the player has won. Save the game as JSecretPhrase2.java.

 

Answered 66 days After May 22, 2022

Solution

Kshitij answered on Jul 27 2022
83 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here