Question
Level 2- Modify the Java program in Level 1 to do the following (Level 1 can be located here https://www.chegg.com/homework-help/questions-and-answers/java-create-word-guessing-game-called-hangman--game-played-computer-one-player-player-need-q20023597) (Please include comments in your
Level 2- Modify the Java program in Level 1 to do the following
(Level 1 can be located here https://www.chegg.com/homework-help/questions-and-answers/java-create-word-guessing-game-called-hangman--game-played-computer-one-player-player-need-q20023597)
(Please include comments in your code)
The basic structure is like your level 1 program concerning any player notifications and 8 lives in one game
Your program should be able to work with at least 20 words.
The words may have different sizes.
Therefore, your program should handle words of various sizes
When the game begins, one of these twenty words are chosen randomly.
Output should display a row of dashes to the user in place of the size of word you used in LEVEL 1
Each dash represents a character of the word to guess.
Player guesses a char
Program compares this char against all the chars of the word.
You program should not be case-sensitive to the entered char.
If there is a match, output (the row of dashes) should be updated with the correct positions of the guessed character(s).
If there is no match, one chance is lost and the user is notified of the same
Output should display all incorrect guesses made.
Stop the game when all 8 lives are used up.
Game should end immediately, if the player has guessed the correct word
Notify the player of a Win or a loss.
Output should display the correct word
The score needs to be tracked in each game
Every time the player guesses the word correctly, update score by +1
Incorrect guess = -1
Sample output is shown below
Sample output-the word to guess is "java" You have 8 lives. Let us play! Enter a char sorry! d is not a character in this word. Try again! You have 7 lives left Enter a char sorry! e is not a character in this word. Try again! You have 6 lives left Enter a char You have 6 lives left Enter a char ja-a de You have 6 lives left Enter a char That is it! You win! The correct word is javg If the player used up all 8 lives, your output must say. Sorry, you have no lives left. You lose! The correct word is javg Sample output-the word to guess is "java" You have 8 lives. Let us play! Enter a char sorry! d is not a character in this word. Try again! You have 7 lives left Enter a char sorry! e is not a character in this word. Try again! You have 6 lives left Enter a char You have 6 lives left Enter a char ja-a de You have 6 lives left Enter a char That is it! You win! The correct word is javg If the player used up all 8 lives, your output must say. Sorry, you have no lives left. You lose! The correct word is javg
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started