Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

CRS modify the any of the provided member they will Cated RS:- They are Use the following class as your starting point to write an

CRS modify the any of the provided member they will Cated RS:- They are Use the following class as your starting point to write an interactive game similar to \"hangmon\" You are not allowed to change the access specifiers of any these variables. However, you con add methods and other members as needed Belass bird publici birdstouse(string lettine) 1/ constructor should open the file and we the words at a birdhouse(); string userGuess 1 stere to store the war esses. The to the privatal string wordList 17 list of words reed from the file string randomierd; 1 A randon word from the list usred short int Nuords; // Number of words read from the file wesigned short int Runess; 11 current number of user presse car wingut 1 ter inout unaigre short int wordtength 1 variable to store the death of the random word to guess Then they can Cated RS - All and the Csehode 1. Ask the user to enter the name of the file that they want to read the list of words from (1 point) 1.1. The user should enter the file's name without the extension

Exemple: If the file's name is \"words.txt\", the uter should only enter\" words 1.2. Your code should assume that the user is following the instructions, there is no need to check If the entered nome complies with the requirements or not 2. The list of words (10 words) is stored in the attached text file 'words.txt\". Your code must read the words from the file and store the words to be guessed in a string called word (2 points) 2.1. The overloaded clous constructor should only accept the file name os on Input parameter without the extension 2.2. The constructor should add the extension to the posed file name before it opens the file for reading

Hints to anached the extension to the file name, you need to content the two strings 2.3. There are 10 words in the provided text file, however, you program should work for any number of words 2.4. Since words is o pointer touring dos, you can allocate memory to sing (new) order to figure out how many words are in the list, you can follow these steps 2.4.1. Create a local string onroy with 100 elements 2.4.2. Read the words from the lindo thot arroyond count how my word did you read from the file 2.4.3. Make sure to read all you reach end of the Hile 2.4.4. Allocate memory to the wordList as needed based on the number of word read. To allocate memory using \"new\" operator, you can use the following o wordList = new string[n]// n is the number of words read from the file 2.4.5. Copy the words from the temporary string array to wordList. To copy values from one string array to another you can use \"copy\" function. This function requires three inputs in the following order, \"Pointer to first element of the source array, Pointer to last element of the source array, the destination array\". The copy function requires to #include

Example: if we want to copy 10 elements from \"sre\" array to \"dst\" array, we can use copy as follows: O copy(src, src+10, dist), // copy first 10 elements from source to destination 3. The class destructor should free the memory allocated to wordList and set all other values to zeros. (1 point) 3.1. To free memory in C++, you can use \"delete\" operator

delete[] wordList; // this will free a dynamic array 4. Your program should randomly choose a word from the list (array) and store it into the string randomWord. This will be the word that the player will have to guess. (1 points) 4.1. Once you chose the random word, your code should set wordLength with word's length. Also, you should output the word's length to the player 4.2. Remember that you need to set the seed for the rand() function otherwise every time you run your program you will get the same word. Setting the seed has to be done once at the beginning of your program (main). 5. The player must guess the letters belonging to the randomly chosen randomWord. The player hos oight incorrect guesses before they lose the game. (2.5 points) 5.1. The program should terminate when either if all letters have been guessed correctly (the player wins) or the eight incorrect guesses have been made the computer wins). 5.2. Hint: You can treat the string randmWord as an array to check each character. 5.3. Use the other string array, userGuess, to keep track of the solution so far. 5.4. Initialize all elements of userGuess to the symbol. Each time a letter from the randomWord is guessed correctly, replace the corresponding In UserGuess with that letter 6. Every turn, prompt the user an option to guess the word (enter 1). (1 points) 6.1. If the player enters 1. your code should ask the user to guess the word. If the guessed word is wrong, then the player loses immediately even if they had more guesses loft. 7. Printout port of the bird house drawing with every wrong guess, similar to the screenshots below: (1.5 points) Commented RSS: Their program should che word every time is Not was the same and want Come RS Run their game and test imthe words in the so, you can then for fetler Commented 0.5 poco Cated explica. They 1 wrong guess 24 wrong guess 34 wrong guess 4 wrong guess: Sh wrong guess 6 wrong guess 7 wrong guess 8 wrong guess Commented RS9: They will receive 25din they implement verything in main.co Cumsted IRSION: They will cover if they we any bal variable . . Assignment requirements

Name your project \"Firstname_lastname_A02\"

You have to divide your solution into multiple files (main.cpp, birdHouse.cpp and bird Househ,

Don't use any global variables You have to properly assign data types based on what is needed (example unsigned charf you variable's maximum value is 230 and minimum is 0) This artignment is to test your understanding of classes, methods, access specifiers, setters and getters You have to use the provided clos o You have to use setters and getters You have to use methods

You should add comments to your code Don't use anything that we haven't discussed up to this point in the course (Topic 01-04). You have to use Visual Studio on Windows There might be similor Ideas available online if you are any code that is available online you will receive a zero You have to solve the assignment on your own without the help of others. Once you are done solving the assignment Follow these instructions to prepare you solution to be submitted. Failure to follow the instructions will result in a 25% deduction regardieu of whether your solution works 100% or not Cated if they don't worth flowing then they will receive a ver . . . . Commented 12. they but the main don't want all reques or don't delete the debug or foder, they will receive a deduction by desit on the final grade of the entregues of whether the code wors 100 If a student received 2Niin Ale not following the struction, they will NON deduction in the night

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

9781292016924

More Books

Students also viewed these Programming questions

Question

6-4 Explain how to use two work simulations for selection.

Answered: 1 week ago

Question

5-21. What would a Hotel Paris help wanted ad look like?

Answered: 1 week ago