Question: Write a Java program called Hangman.java that reads a word (or a phrase) from a user and plays the hangman game. In the assignment, you

Write a Java program called Hangman.java that reads a word (or a phrase) from a user and plays the hangman game. In the assignment, you can assume that the word (or a phrase) from a user is all capitals in a single line. The user will type only alphabet letters and blank spaces.

The following presents a sample run of how the program should look. Read the sample run very carefully to understand the operation of the program.

Write a Java program called Hangman.java that reads a word (or a

Welcome to Hangman -- e WOrd 13: A. You have 2 incorrect quesses left Enter either 1 for guessing or 2 Enter a word: IT IS EASY e WOrd 13: Enter your guess: B Not valid input. You already guessed B. You have 4 incorrect quesses left. Enter either 1 for guessing or 2 for hint: A Incorrect input. Enter either 1 for guessing or 2 So far, the word is: A. You have 1 incorrect guesses left. Enter either 1 for guessing or 2 Incorrect input. Enter either 1 for guessing or 2 for hint: One Incorrect input. Enter either 1 for guessing or 2 Enter your guess: E That's right! E is in the word So far, the word is: A. You have 1 incorrect guesses left. Enter either 1 for guessing or 2 Incorrect input. Enter either 1 for guessing or 2 Enter your guess: # Incorrect input. Enter your guess: 1 Incorrect input. Enter vour quess: B Sorry, B isn't in the word. Enter vour quess: S That's right! S is in the word So far, the word is: You have 1 incorrect guesses left. So far, the word is: Enter either 1 for guessing or 2 You have 3 incorrect quesses left. Enter either 1 for guessing or 2 Enter vour guess: Y Enter vour guess: 1 Incorrect input. Enter your guess: A That's right! A is in the word That's right! Y is in the word So far, the word is: You have 1 incorrect guesses left Enter either 1 for guessing or 2 e WOrd 13: Enter your guess: I A. You have 3 incorrect quesses left Enter either 1 for guessing or 2 That's right! I is in the word So far, the word is: 1 # 1 S # E You have 1 incorrect guesses left. Enter your guess: F Sorry, F isn't in the word. Enter either 1 for guessing or 2 So far, the word is: A. You have 2 incorrect guesses left. Enter either 1 for guessing or 2 Enter your gues3: T That's right! T is in the word Congratulations! The word was 1 T # IS#EASY Enter your guess: A Not valid input. You already ue39e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!