Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSE 142, Winter 2022: Assessment 6

Objectives

This assignment will assess your mastery of the following objectives:

Write a functionally correct Java program to produce specified console output.

Use Scanner and File to read input from a file.

Use PrintStream and File to write output to a file.

Write and call methods that accept parameters and return values to manage information flow and

add structure to programs.

Follow prescribed conventions for spacing, indentation, naming, and comments.

Program Behavior

"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 a    humorous outcome.

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 represented as C, V, and Q, case-insensitively. If anything else 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 writes 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:

Sample program execution #1

⚠ Menu options

should be case-

insensitive. If an

unrecognized

option is entered,

the user should

be re-prompted

until a valid

option is given.


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.

(C)reate mad-lib, (V)iew mad-lib, (Q)uit? c

Input file name: oops.txt

File not found. Try again: TORZON.txt

File not found. Try again: tarzan.txt

Output file name: out1.txt

Please

Please

Please

Please

type an adjective: silly

type a plural noun: apples

type a noun: frisbee

type an adjective: hungry

Please type a place: Tacoma, WA

Please type a plural noun: bees

Please type a noun: umbrella

Please type a funny noise: burp

Please

Please

Please

Please

Please

type an adjective: shiny

type a noun: jelly donut

type an adjective: beautiful

type a plural noun: spoons

type a person 's name: Keanu Reeves

Your mad-lib has been created !

(C)reate mad-lib, (V)iew mad-lib, (Q)uit?

(C)reate mad-lib, (V)iew mad-lib, (Q)uit?

(C)reate mad-lib, (V)iew mad-lib, (Q)uit? Input file name: OUT001.txt

X

I don't understand.

V

File not found. Try again:

File not found. Try again:

File not found. Try again:

i forget the file name

something.DOC

out1.txt

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 mad-lib, (V)iew mad-lib, (Q)uit? Q