Question: This needs to be in C++ - In your CSC1300LAB folder, create a LAB6Purple_yourTTUusername folder and inside that folder, create a source file narmed lab6.cpp-
This needs to be in C++




- In your CSC1300LAB folder, create a LAB6Purple_yourTTUusername folder and inside that folder, create a source file narmed lab6.cpp- - Make sure you put a comment black at the top ot your source file with the filename, author, date, and purpose. Also malee sure there are appropriate comments throughout your program. You should have a comment abowe each function saying the function rame \& purpose of the function. - Test your propram with both sample outputs provided in this document.. Main Function - Write a loop that will allow the user to continue to run the program again until they select to "Save & Quit Program from a menu of choices. - Inside the loop, call the displayMenuGetChoicell function, which should return the user's choice and you will store that value in an integer variable. - Based off the user's choice, use a switch statement to execute the proper action. - If the user selected 1 , then let the user enter morister data from the screeri. The user will be able to eriter the monster's name, monster's age in years (integer], monster's height in fect (double), monster's weight in pounds [dibuble], the food the monster prefers, and a fun fact about the monster. - If the user selected 2, then your program should open the "monsterData.txt" file and thern read each piece ol data from the file and store the data in variables. Then, close the filc. Last, print a confirmation stating the - If the user selected 3, then your program should print the monster's data neatly to the screen. Refer to sample output to view the sugeested format. - If the user selects 4 then the program will exit the loop and then will call the printTofile() function, sending the monsterNarne, age, height, weight, monsterFoud, and funFact to this function. - Then, the program shauld print *GOODBVE!* to the screen- (this should be printerd in the main functian, rot the printToFile function) displayIMlenuGetchoice() Function This function will do the fallowing: - Prints a menu of choices (refer to sample output) and asks the user to choose 14. - Reads in the user's choice - Validates that the user's choice is withir the rarige af 1 thraugh 4 inclusively. If rot, then it should torce the user to enter again until valid choice is selerted. - Returns the user's choice from this function, which is an integer. printToFile() Function This function will do the following: - Accepts six argurnents containing munster data - Upens an output file called "monsteruata.txt". - Prints the ronorister data to the file - one piece of infarmation per line. - Clases the tle. - Prints a confirmation that the monster (print monster's name) has been saved to monsterdata.txt. (this should be printed in the prirtTorile function, not the main function) 1. Enter a Monster's Data Irom sereen 2. Read a Monster's Data from Pile 3. Print the Monster's Data to screen 4. Save a guit Rrograr CHOoss 14:2 The monaterData, txt f1le does not exiat. 1. Enter a Monster'a Data from screen 2. Read a Monater'a Data from bile 3. Print the Monater'a Data to acreen 4. Save t Pregxan choose 1-4: 1 Monster Name: David the Gnore David the Game's age (years): 175 David the Cnoma'a height (feet) : 3.5 David the Gnome's weight (pounds): 46.5 good that David the Gnome prefers: nuts, mashrooms, peas, beans, applesauce, fruit, berries, tubers, spices, and preserves Fun fact about David the Gnome: David is banned from the Middle Tennegaee Horticultural Society Rose show due to poking attendees with rose thorna last year. 1. Enter a Monster's Data rrem Sereen 2. Read a Nonster's Data from Pile 3. Print the Monater'a Data to acreen 4. Save coutt erogran CHOOSE 1-4: 3 MCNSTGR NaME: David the Gnome AGE (YERRS): 175 HEIGHT (FEET) : 3.5 ICAT (POUNDS) =46.5 GOOD IT MATS: nuts, mushrooms, peas, beans, applesauce, fruit, berries, tubers, spices, and preserves EUN IMCT: David is banned from the Middle Tennesaee Horticultural society Rose show due to poking attendees with rose thorns last year. 1. Enter a Monster's Data from sereen 2. Read a Monster's Data from Eile 3. Print the Monater's Data to acreen 4. Save o cuit Prograr choos: 1-4: 9 Invalid input. CHoose 1-4: 4 The monater, David the Gnome, has heen aaved to the monaterData.txt file. cCODEYE 1 MONSTERDATA.TXT AFTER RUNNING SAMPLE OUTPUT 1 W morete Data tat - Notepad Fie Edit Fomat Vowa Help David the Ginme 175 3.5 46.5 nuts, mushrooms, peas, beans, applesauke, frut, berries, tubers, spices, and presenes David is banned from the Midcle Tennessee Horbculturel Society Rose Show due to poking atlendees with rose thams last year
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
