Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2 The questions in this part of the assignment will be graded. General rules for the hangman word game: (http://en.wikipedia.org/wiki/Hangman_%28game%29) Hangman is a guessing

image text in transcribed
Part 2 The questions in this part of the assignment will be graded. General rules for the hangman word game: (http://en.wikipedia.org/wiki/Hangman_%28game%29) "Hangman is a guessing game for two or more players. One player thinks of a word, phrase or sentence and the other(s) tries to guess it by suggesting letters within a certain number of guesses." The game is over when: The guessing player completes the word or guesses the whole word correctly, or the number of tries is exhausted. Programming Question #1: Hangman2 Game (only to guess the word) 1) The word to guess can have repeated letters. 2) The word to guess is not case sensitive, and only up to a maximum of 10 characters. 3) The guessing player has 10 tries to find the letters. 4) The player can guess the entire word in one shot, at any time of the game, or S/he must can guess and write one letter at a time. Recommended skeleton of the structure of your program (refer to screen shots for examples): 1) A player enters the word to guess. Remember a word can only have letters. 2) Print 20 blank lines to clear hide the word to guess from the screen, before guessing player starts. 3) Guessing player (the other player) is shown with stars for the number of letters in the word to guess. Your program also shows the number of guesses left as well as a list of the letters still not picked (See sample run output below). 4) Guessing player is prompted for a letter. 5) As long as the input is more than one character long, is not a letter or is a letter that was already tried, your program should keep on prompting the user for valid input. Incorrect entries should not be counted as guesses. 6) Once a valid letter is entered, your program (a) updates the list of letters (alphabet) still left to try by removing this letter from the list if there are no more characters of the same letter in the word, (b) reduces the number of guesses left by one, and (c) checks whether the letter is part of the word to guess. If it is, then replace the star with the letter in the appropriate position. Steps 3 to 6 are repeated till all letters in the word are found or reaches 10 guesses. 7) Your program name must be "Hangman2" and all program code must be in the main() method. Your program should use: character arrays, selections, and loops. Your program shouldn't use Strings. However, you can use String to Array and vice versa, conversion methods such as: .toCharArray() method; and String. valueOf() method to convert String to Character array and vice versa. You can convert an array to string for printing (i.e., display) purpose, and Arrays.equals(, ) for equality. Your program ends with a summary of the game (See sample output). Page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions