logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

You will write a menu-based program that will allow the user to play Mad Libs! There should be a minimum of three different Mad Libs that the user may play.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

MADLIBS World’s greatest World Game

DESCRIPTION:

You will write a menu-based program that will allow the user to play Mad Libs!  There should be a minimum of three different Mad Libs that the user may play.

SPECIFICATIONS:

  • You must have a minimum of five functions

    • main function –

      • Call showMenuGetChoice to display the menu & get the user’s choice.

      • Open appropriate file according to choice.

      • The first line in the file contains how many questions or prompts there are for the particular mad libs game. You need to read this number from the file in order to know your array sizes.

      • Call createStringArray function to dynamically allocate an array of strings that will hold all the questions (or prompts). Then call the createStringArray function again to dynamically allocate an array of strings that will hold all the answers that the user enters during the game.

      • Read the questions/prompts from the appropriate file, close the file.

      • Call the getInfoFromUser function to get the answers from the user.

      • Call the printStory function to print the completed MADLIBS story.

      • Make sure to deallocate any arrays that were allocated during program.

      • The menu should continue to display until the user decides to end the game.

    • showMenuGetChoice function – show the menu, get the user’s choice, validate the user’s choice, return the users choice from this function

      • The menu is a list of MAD LIBS games that the user can choose from including

        1) The Power of the Force (Star Wars Mad Libs),

        2) Dog Days (Dog Ate My Mad Libs), and

        3) Talk Like a Pirate (Pirates Mad Libs).

        Option 4 of the menu should be to end the game.

    • createStringArray function – accepts an integer indicating the size of the array to be created, dynamically allocates a new string array of this size & returns a pointer to this array.

    • getInfoFromUser function – this function accepts three parameters – pointer to question array, pointer to answer array, and the array size. The function supplies the user with each question or prompt (from the question array) and then allows the user to enter in an answer (put this in the answer array).

    • printStory function – this function accepts three parameters – the user’s choice (so you know what file to open), the answer array, and the array size. Open the appropriate file (for example starWarsText.txt), make sure the file exists and if it does, parse the file and print out answers from the answer array as necessary.  Basically you will do the following repeatedly:  read in a line from a file, print the line, print an answer from the array.  Make sure to close the file.

  • Use pointer notation instead of array notation function parameter lists.

  • When accessing an array element, use pointer notation instead of array notation.

    • Example of array notation: myArray[x]

    • Example of pointer notation: *(myArray+x)

  • You may not have any global variables – even if they are constant. This is so you must practice sending data to/from functions!

  • The user must be able to run the program as many times as they wish.

  • You must have a comment block at the top of your program as well as a comment above each function telling the function name & purpose.

  • You must indent your code properly.

GIVEN:

  • You will be given all necessary files for three Mad Libs games. For example, for the Star Wars mad libs game you are given two files:

    • txt – contains # of questions/prompts as well as the prompts

    • txt – contains the text needed to create the story. Between each line an answer will be inserted.

  • Note: if you have a MAC, you may have to change the line endings of the text file in order for the files to be read from your computer. The other option is the copy the text from the text files that I give you and create new ones (named the same name) on your MAC.

WHAT TO TURN IN:

Zip all the following files in a zip file and upload the file to the Program 4 ilearn submission folder.

  • cpp

  • txt

  • txt

  • txt

  • txt

  • txt

  • txt

EXTRA CREDIT OPPORTUNITY!

Do you want extra credit on this program? To get 5 points of extra credit, you can create & add into the program menu your OWN Mad Libs story!  You will have to modify the menu of choices and create two files for the story in order to be awarded the extra credit.

SAMPLE OUTPUT:

Let's Play some MADLIBS!!

 

Choose a MAD LIBS game:

  1. The Power of the Force (Star Wars Mad Libs)

  2. Dog Days (Dog Ate My Mad Libs)

  3. Talk Like a Pirate (Pirates Mad Libs)

  4. END GAME

 

CHOOSE 1-4:  1

 

Please give a response for each request.

 

adjective:  flexible

plural noun:  kisses

noun:  friend

adjective:  enthusiastic

part of the body:  elbow

adjective:  undesirable

plural noun:  movies

part of the body:  eyeball

adjective:  distracting

adverb: always

noun:  momma

part of the body (plural):  feet

adverb:  silently

 

The Force is a mystical, flexible power. As Jedi Master Obi-Wan Kenobi once said, "The Force is an energy field, created by all living kisses, that surrounds us, penetrates us, and binds the friend together."  Using the power of the Force, a Jedi can do many enthusiastic things, like using the Force to exercise elbow control over undesirable-minded movies.  A Jedi can also use the Force to move objects with his or her eyeball.  It doesn't matter how distracting these objects are; it only matters how always the Jedi believes in the Force.  Most importantly, the Force teaches a Jedi to rely on his or her feelings.  As Obi-Wan Kenobi told his student, Luke momma-walker: "Your feet can deceive you.  Don't trust them."  Instead, a Jedi should silently trust in the Force.

Let's Play some MADLIBS!!

Choose a MAD LIBS game:

  1. The Power of the Force (Star Wars Mad Libs)

  2. Dog Days (Dog Ate My Mad Libs)

  3. Talk Like a Pirate (Pirates Mad Libs)

  4. END GAME

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

919 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

754 Answers

Hire Me
expert
Husnain SaeedComputer science

783 Answers

Hire Me
expert
Atharva PatilComputer science

602 Answers

Hire Me

Get Free Quote!

316 Experts Online