Homework 1: MadLib

Short Description:

Write a program that allows a user to play a mad lib.

This assignment is worth 10 points.

Goals

When you finish this homework, you should

Formal Description

Read chapter 0 - 4 of Eloquent Javascript, Third Edition.

In addition, it might be useful to know that this script:

<script type="text/javascript">
let note = "Hello from the Script!";

document.write("<p>", note, "<p>");
</script>
Produced this output
 

Write a very simple mad lib game. At a minimum, use the prompt command to get input and the document.write example above to produce output.

You should read the story from a file. The format of a file is

An example of the input file would be
5
a name
a color
a thing
a place
an animal
<h1>The Story of #0 </h1>
One day #0 decided to go to #3 to look for a #1 #2 they had lost.
When #0 got to #3 the #1 #2 was not there.
#0 was sad and went home.
When #0 got home, they found that the #1 #2 was there so #0 was happy after all.
#0 loaded his pet #4 into the #2 and went back to #3 just to show off.
Assuming the user provided the following input
Bob
red
wagon
School
dog
The output should be:

The Story of Bob

One day Bob decided to go to School to look for a red wagon they had lost. When Bob got to School the red wagon was not there. Bob was sad and went home. When Bob got home, they found that the red wagon was there so Bob was happy after all. Bob loaded his pet dog into the wagon and went back to the dog for fun.

You may make up or find your own story for the mad lib, or you might consider using one of these free very short stories..

Your mad lib must have at least three different words or phrases that you request from the user. For example if you use The Bat And The Weasels Fable you might allow the user to provide alternatives for bat, weasel, bird and mouse. This would allow the user to create the story of The Elephant and the Bacteria. Did you know Bacteria are enemies of an Emu?

Please keep your stories rated PG or lower.

I expect this program to be written at the CSCI 130 program 2 level. If you know javascript, or want to work ahead, please use an array, but this is by no means required.

If you are unfamiliar with Mad Libs, see the Wikipedia Page.

Documentation

Please use relative references to your code in the html file. This will allow me to extract the file in my local environment.

Please submit two linked html files.

The first provides