MIS 3371 -- PARKS -- MIDTERM - SUMMER 2013

Internet Movie Database
Top 250 Movies by User Votes

My favorite movie
1. (50 points) The textarea shown to the left is named ta1, the textbox is named myfav and both are in a form named f1. The textarea contains the IBDM website's top 250 movies as voted by the site's users (http://www.imdb.com/chart/top) Each of the 250 movies contains:
  • rank followed by a semicolon
  • average voter rating (0 to 10) followed by a semicolon
  • movie title followed by a semicolon
  • year released followed by a semicolon
  • number of votes followed by a "*"
    (NOTE: the last movie has NO "*" after the number of votes)
Using javascript write a function named p1 that:
  1. Retrieves the data from ta1 and myfav
  2. Produces a 250 rows table, 5 column table with columns for:
    1. rank
    2. average voter ranking
    3. movie title
    4. year
    5. number of votes
  3. as the table is being produced, compare each each "movie title" to myfav and determine if myfav is in the Top 250.
  4. following the table:
    1. show the total votes casted for all movies (i.e., the sum of the last table column)
    2. then show the value of myfav and either: (a) "was found" AND the rank or (b) "was NOT found"
  5. Place:(a) the output table; (b) the total vote count, and (c) the outcome of the myfav test into the DIV block with id="out1"

This is the DIV block with id="out1"

Show NO HTML. Show only the vbscript for p1

Get The Quotations
2. (50 points) The textarea to the left named twain is in a form named f2. The textarea contains the entire short story: "The Celebrated Jumping Frog of Calaveras County" by Mark Twain. Write a javascript function named p2 that shows every quotation in the story (i.e., every string contained between two double quote marks). Specifically:
  1. retrieve the contents of the textarea and stores it as a variable named mark.
  2. split the string on the double quote character and create an array named frog. Because you can't put the double quote character inside double quotes, use the following two lines to perform the split:
    dblq = String.fromCharCode(34);
    frog = mark.split(dblq);
           [NOTE: the 35th character in the ASCII table is the double quote]
  3. in a string named jumping accumulate all the text between the double quotes (i.e., the odd numbered elements of frog):
    1. place a <br> tag, then
    2. place a quotation count ("1.", "2.", "3.", ...etc.), then
    3. the value of a quotation (i.e., each odd numbered array elements of frog)
             [NOTE: this will be a numbered list of all the strings inside double quotes, each on a single line]
  4. create a new HTML page-on-the-fly that:
    1. displays jumping (i.e., each numbered quotation on a new line from the previous step).
    2. AND then shows a count of the number of times the string "frog" appears anywhere in the story

Show NO HTML. Show only the javascript for p2

Story from:
www.americanliterature.com/author/mark-twain/short-story/the-celebrated-jumping-frog-of-calaveras-county

Originally printed in The Saturday Press, Nov. 18, 1865. Republished in The Celebrated Jumping Frog of Calaveras County, and Other Sketches (1867), by Mark Twain, all of whose works are published by Harper & Brothers.