-------------------------------------------------------------------------------
Michael Locasto Introduction to Computers
Homework 2 Spring 2006
$Id: hw2.txt,v 1.1 2006/02/15 21:42:33 locasto Exp $
-------------------------------------------------------------------------------
Due: March 9, 11:59:59 PM EST (Courseworks timestamp)
0) Mad Lib. (80 pts)
The game 'Mad Lib' is a word replacement game with often hilarious
results. The object of the game is to fill in "missing" parts of a
passage of text with words that are the correct parts of speech,
but may not necessarily be correct words for the context of the
passage.
The first player asks the second player a series of questions.
Each question is basically a query for a part of speech. The second
player responds with a word that is the correct part of speech (verb,
noun, adverb, adjective, direct object, indirect object, exclamation,
proper noun, etc.)
After all the missing words or phrases have been filled in, the
first player reveals the "completed" text to the second player,
everyone laughs, and the game is over.
Implement a web page that uses Javascript to play the Mad Lib
game. You should force the user to enter input for each word.
You should have at least 3 paragraphs to complete and 15 missing
words or phrases. The paragraph can be written by you, or be a
news story or other material gathered from the web or print. If
it is not your original composition, make sure to cite the
source. An example of text ripe for parody is the course "policies"
section of the course web site.
Your 15-20 missing words should include a wide range of parts of
speech. In particular, you should check that any adverbs end in
'-ly'. If they do not, make sure to prompt the user again until
they enter a valid word.
Ask the user for all the words without revealing any of the text
of the passage, store them, then display the full text with the
missing words inserted.
1) Short Answer (20 pts)
1.1 What is the value of 'j' after this code executes?
var i = 0;
var n = 10;
var j = 5;
for(i=0;i");
document.write(typeof y);
document.write("
");
document.write(typeof m);
document.write("
");
document.write(typeof z);