Question: This assignment focuses on file input/output and strings. Turn in a file named MadLibs.java and mymadlib.txt. Mad Libs are short stories that have blanks called
This assignment focuses on file input/output and strings. Turn in a file named MadLibs.java and mymadlib.txt. "Mad Libs" are short stories that have blanks called placeholders to be filled in. In the non-computerized version of this game, one person asks a second person to fill in each of the placeholders without the second person knowing the overall story. Once all placeholders are filled in, the second person is shown the resulting story, often with humorous results. In this assignment you present a menu to the user with three options: create a new mad lib, view a previously created mad lib, or quit. These are shown as C, V, and Q, case-insensitively. If any other command is typed, the user is re-prompted. When creating a new mad lib, the program prompts the user for input and output file names. Then the program reads the input file, prompting the user to fill in any placeholders that are found without showing the user the rest of the story. As the user fills in each placeholder, the program is writing the resulting text to the output file. The user can later view the mad lib that was created or quit the program. The log below shows one sample execution of the program.

Welcome to the game of Mad Libs I will ask you to provide various words and phrases to fill in a story The result will be written to an output file Console Interaction (C) reate mad-lib, (V)iew mad-lib, (Q)uit? c Input file name: oops.txt File not found. Try again: mabldibl.txt File not found. Try again: madlIb.EXE Output file name :1.txt Please type an adjective: sill Please type a plural noun: apples Please type a noun: frisbee Please tpe an adjective: hun Please type a place: Tacoma Please type a plural noun Please type a noun: umbrella Please type a funny noise Bu Please type an adjective: shin Please type a noun: Please tpe an adjective: beautiful Please type a plural noun spoons Please type a person's name Keanu Reeves Your mad-lib has been created es (C)reate mad-lib, (V)iew mad-lib, (Q)uit? X (C)reate mad-lib, (V)iew mad-lib, (Q)uit? I don't understand (C) reate mad-lib.(-)iewmaa-lib, (Q) uit ? Input file name: OUT001.txt File not found. Try again i forget the file name File not found. Try again: omehin File not found. Try again: One of the most silly characters in fiction is named "Tarzan of the apples ." Tarzan was raised by a/an frisbee and lives in the hungry jungle in the heart of darkest Tacoma, WA . He spends most of his time eating bees and swinging from tree to umbrella Whenever he gets angry, he beats on his chest and says, " burp "This is his war cry. Tarzan always dresses in shiny shorts made from the skin of a/an jelly donut and his best friend is a/an beautiful chimpanzee named Cheetah. He is supposed to be able to speak to elephants and spoons. In the movies, Tarzan is played by Keanu Reeves . (C) reate maa-lib, (V) lew mad-lib, (Q) uit? Welcome to the game of Mad Libs I will ask you to provide various words and phrases to fill in a story The result will be written to an output file Console Interaction (C) reate mad-lib, (V)iew mad-lib, (Q)uit? c Input file name: oops.txt File not found. Try again: mabldibl.txt File not found. Try again: madlIb.EXE Output file name :1.txt Please type an adjective: sill Please type a plural noun: apples Please type a noun: frisbee Please tpe an adjective: hun Please type a place: Tacoma Please type a plural noun Please type a noun: umbrella Please type a funny noise Bu Please type an adjective: shin Please type a noun: Please tpe an adjective: beautiful Please type a plural noun spoons Please type a person's name Keanu Reeves Your mad-lib has been created es (C)reate mad-lib, (V)iew mad-lib, (Q)uit? X (C)reate mad-lib, (V)iew mad-lib, (Q)uit? I don't understand (C) reate mad-lib.(-)iewmaa-lib, (Q) uit ? Input file name: OUT001.txt File not found. Try again i forget the file name File not found. Try again: omehin File not found. Try again: One of the most silly characters in fiction is named "Tarzan of the apples ." Tarzan was raised by a/an frisbee and lives in the hungry jungle in the heart of darkest Tacoma, WA . He spends most of his time eating bees and swinging from tree to umbrella Whenever he gets angry, he beats on his chest and says, " burp "This is his war cry. Tarzan always dresses in shiny shorts made from the skin of a/an jelly donut and his best friend is a/an beautiful chimpanzee named Cheetah. He is supposed to be able to speak to elephants and spoons. In the movies, Tarzan is played by Keanu Reeves . (C) reate maa-lib, (V) lew mad-lib, (Q) uit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
