Question
Write a java program to play Hangman, the computer first selects a secret word as random from a list built into the program. Use ArrayList
Write a java program to play Hangman, the computer first selects a secret word as random from a list built into the program. Use ArrayList for secret words and user input words. The program should work with a secret word as random from a list. The program then prints out a row of dashesone for each letter in the secret wordand asks the user to guess a letter. If the user guesses a letter that is in the word, the word is redisplayed with all instances of that letter shown in the correct positions, along with any letters correctly guessed on previous turns. If the letter does not appear in the word, the user is charged with an incorrect guess. The user keeps guessing letters until either (1) the user has correctly guessed all the letters in the word or (2) the user has made eight incorrect guesses. For each wrong guess print as given below, show the drawing after the first incorrect guess (just the head), the third (the head, body, and left arm), and the diagram at the tragic end of a losing game: Write a separate class named HangmanLexicon for getting the word and matching the word. A separate class named HangmanDraw is attached which must use to draw hangman for the 1st ,3rd and 8th wrong guesses. Write another class Game with main function where you accept user guesses and display game.
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