Question: Please help me to solve this question Comment: I want to solve it with the method in the description below + using array .. thank
Please help me to solve this question
Comment: I want to solve it with the method in the description below + using array .. thank you so much ..


OUTPUT:



For this assignment, your mission is to write a program that plays THE GAME OF HANGMAN. As an assignment, Hangman will give you practice with Strings, one dimensional arrays processing, parameters, and return values, while also in itself being a fun console-based game to play The Game of Hangman Hangman is a single-player game where the player has a finite number of guesses to try and guess all the letters that make up a secret word. After printing an introductory message explaining the game to the player, the computer selects a secret word at random. Then the player does a series of turns the player guesses a letter from A-Z. In each turn, the program shows a hint about the secret word. The hint is initially a row of dashes, one for each letter in the secret word. For example if the secret word is "HELLO", the hint is"" If the player's guess is a letter that appears in the secret word, the hint is updated so that all instances of that letter are shown in their correct positions. For example, if the secret word is "SHELLS" and the player guesses "H", the hint becomes "-H--". If the player then guesses "L", the hint becomes "-H-LL-" Note that your program should be case insensitive; it should accept uppercase or lowercase letters and treat them the same. The game ends when either the user has correctly guessed all the letters in the secret word, or the user has made five (5) incorrect guesses. At the end, the program reveals the secret word, indicates whether the player won or lost, and asks if they would like to play again. If the player chooses to play again, another game begins. When the player chooses not to play again, the program prints statisties about all games. Show the total number of games, games won, loss game Note: String[] word list- "ruby", "python", "java", "fortran", "html", "php"; Required Methods: As in past assignments, we ask you to break apart the overall task into methods. Therefore, we are going to tell you what methods you should have (and require these methods) in your program. You may not create additional methods if you like, but you must have the methods shown below with exactly these names and exactly these parameters (no more, no less) and return types. Do not change the method definitions in any way, or you will be substantially penalized. The reason we are requiring these methods is to provide practice using parameters and return values to communicate between these methods Table 1: List of required methods in Hangman (you must write all of these methods as shown) Return type Method name Parameters Function n this method, you should print the following ntroductory text that appears at the start of the program blank line of output should appear after the text. tro void No parameters Hangman Game! I will think of a random word You'1l try to guess its letters Try guess correctly to avoid loses! n this method you should return secret word that is etsecretHord String No parameters l wo s foring word list String[jword list={ "ruby", python","java", fortran, "html", "php" i; n this method, you should do all the work to play a single ame of Hangman with the user from start to finish with he help of invoking other methods inside this method. ou should prompt the user to type a single letter to uess ystem.out.print"nEnter your Guess Letter:"); You need to invoke other methods such as layOneGameb String secret_word, |This method returns true if the guessLetter is a char guessLetter will update the secret_letter array accordingly charl] secret_letter secret_letter still has letters needs to be correctGuess boolean char[l secret_letter, |guess that is found in the secret_word and it This method returns int value if the array winningStateint guessed. n this method, you should print the final statistics that display fter all games of Hangman have been played. You should rint the total games played, number of games won and umber of games loss. int[] game stat, ystem.out.println etStat void ystem.out.println("Your final Profile status:") ystem.out.println(" ystem.out.printIn("total number of won games +total won) ystem . out.println("total number of loss games int index "+total loss) Hangman Game! I will think of a rand You'll try to guess its letters. Try guess correctly to avoid loses! om word You have 5 trials left. Word: Enter your Guess Letter: f You have 5 trials left. Word: f Enter your Guess Letter: o You have 5 trials left Word: f o Enter your Guess Letter: r You have 5 trials left. Word: forr Enter your Guess Letter: t You have 5 trials left. Word: fortr__ Enter your Guess Letter: a You have 5 trials left. Word: fortra_ Enter your Guess Letter: n Your Attempt Status: number of wrong guess is0 number of correct guesses is 6 You did it right:) , The word is: fortran Do you want to play again (y / n): You have 5 trials left. Word: Enter your Guess Letter: h Misses: h You have 4 trials left. Word: Enter your Guess Letter:j Misses: h You have 3 trials left. Word: Enter your Guess Letter: r You have 3 trials left. Word: Enter your Guess Letter: u You have 3 trials left. Word: Enter your Guess Letter: b You have 3 trials left. r u ord: ru b Enter your Guess Letter: a Misses: hia You have 2 trials left. Word: rub Enter your Guess Letter: y Your Attempt Status: number of wrong guess is3 number of correct guesses is 4 You did it right, The word is: ruby Do you want to play again (y/ n): You have 5 trials left. Word: Enter your Guess Letter: w Misses: W You have 4 trials left. Word: Enter your Guess Letter: r Misses: w r You have 3 trials left. Word: Enter your Guess Letter: w Misses: wr W You have 2 trials left. Word: Enter your Guess Letter: q Misses: wr w q You have 1 trials left. Word: Enter your Guess Letter: w Misses: wr w q w Your Attempt Status: number of wrong guess is5 number of correct guesses is = 0 Wrong :( ,The word was. ..java Do you want to play again (y/ n): Your final Profile status: total number of Hangman games played total number of won games2 total number of loss games1 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
