CSE 142, Winter 2022: Assessment 6
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.
|
2022-02-22