Question: Hangman game using Java Code Hangman is a game where a player must guess a phrase. The program will randomly select and display a movie
Hangman game using Java Code
Hangman is a game where a player must guess a phrase. The program will randomly select and display a movie title in which the letters are hidden by asterisks. If the title is "Lethal Weapon", the program will output ****** ******.
The computer next outputs a random cash prize amount from a string array. This should also be displayed on the screen. Use values $10, $20, $30, $40 and $50. Ex: Your prize is: $10
The computer next reveals hints for the player. It should ask the player to Hit enter key for help. If any of letters R S T L N E exist in the title, the computer should display them. Example: L*r* ** t*e R*n*s
The computer next gives the player two options.
A. Guess the entire title to win the game.
B. Guess a letter (one at a time) that has not yet been revealed to win money prize = (dollarAmount * correctLetters)..
Example, if the player enters 'D', the next display shall be: L*RD ** T*E R*N*S
If the player enters an H, the next display shall be: L*rd ** the R*n*s
If the player enters an G, the next display shall be: L*rd ** the R*ngs
If the player enters an O, the next display shall be: Lord o* the R*ngs
If the player enters an F, the next display shall be: Lord of the R*ngs
If the player enters an F, the next display shall be: Lord of the Rings
And the player wins $10x1(D) $10x1(H) $10x1(G) $10x2(O) Output: Prize = $50
This should continue until the player guesses all of the letters to uncover the title:
Lord of the Rings
When entering guesses or letters, the game should end if:
1. The player enters 3 mistakes (such as misspelling the movie title 3 times or entering 3 incorrect letter) Output= Game Over
2. The player successfully guesses all the letters of the movie title. Output = Winner!
3. The user guesses the entire movie title correctly. Output = Winner!
When the game is over the outputs should display:
- You Win!
- You Win! + Prize
- Game Over. You Lost! (only if player has 3 incorrect guesses for either choice A or B)
- Pick 10 movie titles that generate randomly.
- Cash Prizes ($10, $20, $30, $40 and $50) should also generate randomly
- Use the class Stringbuilder class.
- Show characters in movie titles instead of asterisks. Ex: O' Brother, Where Art Thou? Should output as *' *******, ***** *** ****?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
