For this project, you have written a fun Web page that writes a (really) short story based on information you get from the user. You'll use JavaScript to insert the user's words into the story.
For example, your story might start out like this:
"A long time ago, in a galaxy far, far away, there lived a young man and his trusty robot named C3PO. He had a restless yearning for adventure..."
You created a form where the user enters words, for example: an age, a type of person, and a name.
Then your JavaScript program will merge them together and produce a new version of the story like this:
"A long time ago, in a area near, near away, there lived a middle-aged woman and her trusty robot named Garfield. He had a envious running for pie charts..."
You can see from this example that woman and he don't match up. Several bits of grammar will need to be adjusted using functions you create in JavaScript. For example, when the user supplies words you will have to
- capitalize words that begin a sentence.
- change he, his, and him to she, her, and her, or they, their, and them. These series of words will be held in arrays.
- choose a or an depending on whether the word following it begins with a vowel or noun
So you can see that quite a bit happens when you click the Create a Story button! Don't worry. We'll take it one step at a time.
Points
This project part will be worth 100 points. You will also have the opportunity to earn 15 points extra credit by adding an image and creating an image rollover.