CSCI 1310 Introduction to Computer Programming Assignment 8

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

For this assignment, you need to submit your program to moodle code runner. Please
include comments in your code that explain what your code is doing.
In the game Mad-libs, players are asked for parts of speech, such a noun, adjective, or
adverb, and those words are plugged into a template to generate a sometimes-funny
story.
For this problem, write a program that plays a game of Mad-libs. Your program needs to
store a list of story templates, when the user selects a number between 1 -5 select that
template, and ask the user for parts of speech to fill in the template.
When the program starts, you should first ask the user if they want to play a game.
Your question should look like:
“Do you want to play a game? (y) or (n)”
The user types y if they want to play and n if they don’t. If the user answers y, then your
program should ask the user to enter the template number:
“Please select a template between 1 and 5:”
Let’s assume the user enters 2, you need to ask the entries for each of the missing word
type in the template 2, such as:
“Enter a noun:\n”
“Enter an adjective:\n”
“Enter another noun:\n”
“Enter another adjective:\n”
Note: Template 2 looks like this
“It was the of , it was the of ”
There will be multiple templates with different requirements, your program will need to
handle an arbitrary list of requirements. Build a new variable that includes the user
entries in place of the word-type placeholders and print the variable to show the user
the new sentence.
If the user types “n” when asked if they want to play, your program should print “good
bye” and exit.
The user should be allowed to play the game as many times as they like. Each time after
they play your program should ask if they would like to play again, and if they answer y,
your program should repeat the game, beginning at the spot where you ask the user to
enter the template number. If the user does not enter a number between 1 and 5 your
program should print “Invalid Template” and your program should repeat the game by
asking the user if they want to play again.
Your program needs to include the following templates.
1. “Be kind to your -footed , or a duck may be somebody’s
.”
2. “It was the of , it was the of .”
3. ? I don’t have to show you any !
4. My always said was like a box of . You never know
what you’re gonna get.
5. One