Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hangman challenges the end user to guess a secret word. The end user can have 5 incorrect guesses before the game ends. The game ends

Hangman challenges the end user to guess a secret word. The end user can have 5 incorrect guesses before the game ends. The game ends if the user guesses the correct secret word, or if the user guesses a 6th incorrect letter.?The challenge starts by printing out a welcome message to the end user with instructions and a placeholder for the secret word, represented by blank underscores (the number of underscores printed represent the number of letters in the secret word for the player to guess).?For each round of the game, the end user is prompted to input a guessed letter to see if that letter is in the secret word: If the guessed letter is contained in the secret word, the player has won that round, and the guessed word thus far is printed (consisting of blank underscores and correctly guessed letters). If the user's guessed letter is not in the secret word, the guessed word thus far is printed (consisting of blank underscores and any correctly guessed letters), and the player earns a "tick." The ticks add up. A player can only accumulate 6 incorrect ticks or he loses the game. For each round that the player guesses a letter incorrectly, you should also print out the number of incorrect guesses thus far, based on how many ticks the player has. The end user wins by guessing all of the correct letters in the secret word. When the specialist wins the game, you should print to the console that he has won, along with the secret word.?The end user can also lose. Once all the wrong guess ticks are accumulated the game is over and the user has lost.?For the advanced versions of this game, you should also provide a hint for the secret word to the end user at the beginning of the game and use OO programming to create your own class.?Grading for the project is as follows. Each partial-credit activity builds upon each other, and you may have to rework/rewrite source code to complete the more difficult partial-credit activity. This should NOT be a GUI program - it is text-based.? Project #4 Activity #1 ??Please be aware that for ALL of the projects you will be building upon each activity. This is the first of many.? You are to create the basic program, showing letters for ONE fixed secret word simulation in which you know the word when you're programming it. (another words, you put [hard-code] the secret word in your source code, and every time you play the simulation, the specialist is trying to guess the same secret word) You should use your own functions when creating the basic program. Be sure to prompt the user to end the program at the end of the program.?For this activity, you do not have to do the following: keep track if the player already guessed a letter previously allow the player to guess the secret word in its entirety (the player can only guess a single letter per round) Project #4 Activity #2 ??Please be aware that for ALL of the project activities you will be building upon each prior activity. This is the second of many, you need to successfully complete activity 1 before moving on to this activity.?You are to expand upon your program: You will permit the user to run the program again after the conclusion of the first execution. The user can play as many times, or rounds, as he wishes (which means that he may have to guess a secret word more than once.) The player can exit the program after the completion of any complete execution or round. You should obtain a list of secret words in as input from an external file to be used as the source of the secret word at the beginning of your program (so do this only once). You should ask the secret words in random order - you cycle through the list of secret words in a random order for each execution, or round, the specialist chooses to play as read from the external file. The game would have multiple secret words from which to play from, and the secret word would be selected from the sequence of words in a random order. A random order might look like this: ? Game #1 = secret word: pig ? Game #2 = secret word: mouse ? Game #3 = secret word: cat ? Game #4 = secret word = cow ? Game #5 = secret word = dog ? Game #6 = secret word: zebra ? Game #7 = secret word: rat ? ...etc....until the player ends the program. For this activity, you do not have to do the following: keep track if the player already guessed a letter previously allow the player to guess the secret word in its entirety (the player can only guess a single letter per round Project #4 Activity #3 ??Please be aware that for ALL of the project activities you will be building upon each prior activity. This is the third of many, you need to successfully complete activities 1-2 before moving on to this activity.?You are to expand upon your program, printing out a corresponding hint for the secret word read in from the external text file after the welcome message. You should read the secret words and their corresponding hints in from an external text file at the beginning of your program (each word and each hint are each on its own line in the external text file) and use them for the game execution. This activity is based on previous activities - so this final program must permit the player to play the game multiple times and randomly select the secret word and its hint from all of those that are possible from the file input. Your program should work with ANY text file.?Your external text file could look either way (not including the bullet points):?Option 1: dog, I bark! pig, I oink! cat, I meow! Option 2: dog I bark! pig I oink! cat I meow! Additionally, for this activity, you do have to do the following: keep track if the player already guessed a letter previously allow the player to guess the secret word in its entirety OR the player can only guess a single letter per round Project #4 Activity #4 ??Please be aware that for ALL of the project activities you will be building upon each prior activity. This is the fourth of many, you need to successfully complete activities 1-3 before moving on to this activity.?You are to refactor your program to be object oriented in nature and still accomodate all functionality required in activities 1 and 2 only (you do not have to accomodate hints for this activity - a list of secret words only). You should submit the following: The structure of your object should be as follows: ?Object: WordList?Attributes: *any private attributes you deem necessary to implement this class definition?Methods: *constructor: required for creation of an instance of the WordList object *addWord(): adds one single word to the WordList object [public] *addWordsFromFile(): adds all words to the WordList object from a single text file [public] *getRandomWord(): returns a single word at random from the WordList object [public] *numWords(): returns how many words are in the WordList object [public] *any additional private methods you deem necessary to implementation this class definition Remember, you have to do the following: keep track if the player already guessed a letter previously allow the player to guess the secret word in its entirety OR the player can only guess a single letter per round)

*Program language is Java*

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

Step: 3

blur-text-image

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

Data Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

More Books

Students also viewed these Databases questions

Question

What does 100 percent theoretical air represent?

Answered: 1 week ago