Reference no: EM13692748
Creating a Java application modeled after the game of hangman, where a user must guess a hidden word or phrase in a limited number of guesses.
As part of your solution you will need to create two Java classes that represent graphical objects. The first is the Gallows class which represents the frame upon which the unfortunate Figure class will meet its demise should the player guess incorrectly.
You will also need to create a GUI (graphical user interface) that allows players to interact with your game. This includes the following:
• Entering a guess
• Submitting a guess
• Viewing the number of letters in the word they must guess
• Viewing the completed portion of the word they must guess
• Viewing their progress towards a losing the game
• Being able to reset the game with a new word
• Being able to choose a custom word for a new game
• Being notified when they win or lose the game
• Being given the option to see the secret word if they were not able to guess it
Algorithms:
Develop multiple algorithms in order to solve the following problems:
1. You will need to be able to select a random word from a list of words. See the instructions below for information on the different methods that can be used to accomplish this.
2. You will need to be able to display what portion of the secret word has been discovered and what portion remains unknown. This may be difficult and may involve multiple cases.
3. You will need to check user input to make sure it is valid. This includes making sure that they have entered a letter, checking that they have only entered a single letter, and checking that they have not previously used that letter before.
4. You will need to be able to determine if a guess made by the player is contained in the secret word and either update the displayed portion of the secret word to reflect a correct guess, or visually indicate an incorrect guess by displaying the additional parts of the Figure.
5. You will need to check if a custom word entered by a user only contains valid characters such as letters and reject any input that contains invalid characters.
6. You will need to determine if a player has won or lost the game and appropriately convey that information to the user and ask them if they would like to restart the game.