Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the template below of Fun Family Picnic revise your Mad Lib code to use th

ID: 3720827 • Letter: U

Question

Using the template below of Fun Family Picnic revise your Mad Lib code to use this template and its parts of speech. For every part of speech which occurs in the template more than once, for example Noun, have your program select a different instance of that part of speech for each use in a single execution of your program. In the case of Noun since it is used 10 times you will create a list of 10 Nouns and a different one of the 10 will be used for each substitution it makes in the template.

// Mad-Lib

// Creates a story based on user input

#include

#include

using namespace std;

string askText(string prompt);

int askNumber(string prompt);

void tellStory(string name, string noun, int number, string bodyPart,

string verb);

int main()

{

cout << "Welcome to Mad Lib. ";

cout << "Answer the following questions to help create a new

story. ";

string name = askText("Please enter a name: ");

string noun = askText("Please enter a plural noun: ");

int number = askNumber("Please enter a number: ");

string bodyPart = askText("Please enter a body part: ");

string verb = askText("Please enter a verb: ");

tellStory(name, noun, number, bodyPart, verb);

return 0;

}

string askText(string prompt)

{

string text;

cout << prompt;

cin >> text;

return text;

}

int askNumber(string prompt)

{

int num;

cout << prompt;

cin >> num;

return num;

}

void tellStory(string name, string noun, int number, string bodyPart,

string verb)

{

cout << " Here's your story: ";

cout << "The famous explorer ";

cout << name;

cout << " had nearly given up a life-long quest to find ";

cout << "The Lost City of ";

cout << noun;

cout << " when one day, the ";

cout << noun;

cout << " found the explorer. ";

cout << "Surrounded by ";

cout << number;

cout << " " << noun;

cout << ", a tear came to ";

cout << name << "'s ";

cout << bodyPart << ". ";

cout << "After all this time, the quest was finally over. ";

cout << "And then, the ";

cout << noun << " ";

cout << "promptly devoured ";

cout << name << ". ";

cout << "The moral of the story? Be careful what you ";

cout << verb;

cout << " for.";

Aduit MAD LIBS. FUN FAMILY PICNIC As usual, our family PEPTNUT AUITE? was a/an CNY disaster. Mom packedBEALH sandwiches and STaP salad, and Dad brought a volleyball and a/an PEA Once we got to the POOD LEgrounds, my brother started shooting me with a water SiSf But when I screamed, my mom got mad and said, You just calm down, young PALELEL Dad was having trouble setting up the CtoceLATE net, so I offered to help, but he shouted at the top of his SKATES "Just stay out of the ThrATE -'" Then I went to lend a/an NOUN ADJECTIVE NOUN NOUN NOUN NOUN NOUN NOUN NOUN PLURAL NOUN NOUN Hip to Mom. "Well, it's about time somebody offered to help," she said BOLDLYas she rolled her ?Eas . I spent the rest of the day eating Mom's and watching Dad fight with the PART OF THE BODY ADVERB PART OF THE BODY (PLURAL) roasted SCARVES PLURAL NOUN LANE I wish we could be more like normal BAGaS watching ADJECTIVE NOUN PLURAL NOUN and spend weekends watching SHONY reruns FROM ADULT MAD LIBST DYSFUNCTIONAL FAMILY THERAPY. Text copyright 2005 by Roadside Amusements Published in 2009 by Price Stem Sloan, a division of Penguin Group (USA) Inc, 345 Hudson Street, New York, NY 10014.

Explanation / Answer

I've implemented the following C++ code. Please let me know if this is the thing that was required. If anything needs to be modified or is not clear, feel free to comment. Thanks.

C++ code:

##########################################################################################

// Mad-Lib

// Creates a story based on user input

#include <iostream>
#include <vector>

using namespace std;

string askText(string prompt);

void tellStory(vector<string> nouns, vector<string> pluralNouns, string bodyPart,
string bodyPartPlural, string adverb, vector<string> adjectives);

int main()
{
cout << "Welcome to Mad Lib. ";
cout << "Answer the following questions to help create a new story. ";
vector<string> nouns, pluralNouns, adjectives;
string noun, pluralNoun, adjective;
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
adjective = askText("Please enter an adjective: ");
adjectives.push_back(adjective);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
pluralNoun = askText("Please enter a plural noun: ");
pluralNouns.push_back(pluralNoun);
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
  
string bodyPart = askText("Please enter a body part: ");
string adverb = askText("Please enter an adverb: ");
string bodyPartPlural = askText("Please enter a body part(plural): ");
pluralNoun = askText("Please enter a plural noun: ");
pluralNouns.push_back(pluralNoun);
  
noun = askText("Please enter a noun: ");
nouns.push_back(noun);
pluralNoun = askText("Please enter a plural noun: ");
pluralNouns.push_back(pluralNoun);
adjective = askText("Please enter an adjective: ");
adjectives.push_back(adjective);
  
tellStory(nouns, pluralNouns, bodyPart, bodyPartPlural, adverb, adjectives);
return 0;
}

string askText(string prompt)
{
string text;
cout << prompt;
cin >> text;
cout << endl;
return text;
}

void tellStory(vector<string> nouns, vector<string> pluralNouns, string bodyPart,
string bodyPartPlural, string adverb, vector<string> adjectives)
{
cout << " Here's your story: ";
cout << "As usual, our family ";
cout << nouns[0];
cout << " was a/an ";
cout << adjectives[0] << " ";
cout << "disaster. Mom packed ";
cout << nouns[1];
cout << " sandwiches and ";
cout << nouns[2] << " ";
cout << "salad, and Dad brought a volleyball and a/an ";
cout << nouns[3] << ". ";
cout << "Once we got to the ";
cout << nouns[4];
cout << " grounds, my brother started ";
cout << "shooting me with a water ";
cout << nouns[5] << ".";
cout << " But when I screamed, my ";
cout << "mom got mad and said,"You just calm down, young ";
cout << nouns[6] << "." ";
cout << "Dad was having trouble setting up the ";
cout << nouns[7];
cout << " net, so I ";
cout << "offered to help, but he shouted at the top of his ";
cout << pluralNouns[0] << ", ";
cout << ""Just stay out of the ";
cout << nouns[8] <<"!"";
cout << " Then I went to lend a/an ";
cout << bodyPart;
cout << " to Mom. "Well, it's about time somebody ";
cout << "offered to help," she said ";
cout << adverb;
cout << " as she rolled her ";
cout << bodyPartPlural << ".";
cout << " I spent the rest of the day eating Mom's ";
cout << "roasted ";
cout << pluralNouns[1];
cout << " and watching Dad fight with the ";
cout << nouns[9] << ".";
cout << " I wish we could be more like normal ";
cout << pluralNouns[2] << " ";
cout << "and spend weekends watching ";
cout << adjectives[1];
cout << " reruns.";
}

######################################################################################

INPUT:
peanut
chunky
beach
star
pear
poodle
sister
bracelet
chocolate
skates
theater
hip
boldly
legs
scarves
plane
bagels
shiny

OUTPUT:

Welcome to Mad Lib.

Answer the following questions to help create a new story.
Please enter a noun:
Please enter an adjective:
Please enter a noun:
Please enter a noun:
Please enter a noun:
Please enter a noun:
Please enter a noun:
Please enter a noun:
Please enter a noun:
Please enter a plural noun:
Please enter a noun:
Please enter a body part:
Please enter an adverb:
Please enter a body part(plural):
Please enter a plural noun:
Please enter a noun:
Please enter a plural noun:
Please enter an adjective:

Here's your story:
As usual, our family peanut was a/an chunky
disaster. Mom packed beach sandwiches and star
salad, and Dad brought a volleyball and a/an pear.
Once we got to the poodle grounds, my brother started
shooting me with a water sister. But when I screamed, my
mom got mad and said,"You just calm down, young bracelet."
Dad was having trouble setting up the chocolate net, so I
offered to help, but he shouted at the top of his skates,
"Just stay out of the theater!" Then I went to lend a/an
hip to Mom. "Well, it's about time somebody
offered to help," she said boldly as she rolled her
legs. I spent the rest of the day eating Mom's
roasted scarves and watching Dad fight with the
plane. I wish we could be more like normal bagels
and spend weekends watching shiny reruns.