MIS 3371 -- PARKS -- MIDTERM - FALL 2013

All Time Top Selling Books World-Wide
http://en.wikipedia.org/wiki/List_of_best-selling_books
1. (50 points)The textarea named ta to the left is wikipedia's list of all time best selling books in a form named f1. There are 124 books in the list. Each book listed contains:
  1. Title, followed by a semicolon,
  2. Author, followed by a semicolon,
  3. Language, followed by a semicolon,
  4. Year, followed by a semicolon,
  5. Millions of copies sold, followed by a "*" (except the last one does that NOT have a "*" at the end).
There are 14 languages found in the list. Assume their names are stored in an array named lang (i.e., lang(0)="English", lang(1)="French", lang(2)="Chinese"...lang(11)="Czech", lang(12)="Japanese", lang(13)="Yiddish") DO NOT WRITE THIS ARRAY -- assume the array lang is available for you to use. Create an array named c with 14 elements that will be used to count the number of times the 14 languages are found in the list.

When this button is clicked the sub named p1 is executed. This sub:

  1. Creates the c array and initalize its 14 values to zero
  2. Retrieves the data from the textarea
  3. Produces a 124 row, 5 column table that shows the five data items in five table cells, one book per table row.
  4. Following the table show the number of times each language appears in the table above. Show:
    (a) the name of the language;
    (b) the count of times the language appears in the table
    each of the two data items is on a single line (there will be 14 lines of output for this part)
  5. Place the table and the language/language counts in the DIV block with id="p1out"
This is the DIV with id="p1out"

Show NO HTML. Write only the vbscript for p1.

"The Rules of Civility and Decent Behaviour
in Company and Conversation"
as penned by George Washington

(http://www.foundationsmag.com/civility.html)
2. (50 points) As a boy of 16 George Washington copied the 110 maxims at the left as a penmanship exercise. "The Rules of Civility and Decent Behaviour in Company and Conversation" are based on fifteenth century French documents and were translated into English in 1640. The textarea to the left is named ta2 and is in a form named f2. The 110 rules of behavior appear in the textarea separated by the "*" character. Assume that the javascript function named p2 has a string named tstr composed of the following 36 bytes:
          var tstr = "abcdefghijklmnopqrstuvwxyz0123456789";
Further, assume you have an array named c containing 36 elements.

When this button is clicked, the javascript function p2 is executed that:

  1. retrieves the string in the textarea named ta2
  2. converts this entire string to lower case
  3. splits the string above into 110 strings (one for each "Rules" by splitting on the "*" character). Name this array r.
  4. create a 110 row and 36 column table. The rows represent the results of counting the numbers and letters in one of Washington's 110 Rules. Specifically, columns 1 through 26 show the count the occurrences of the letters "a" through "z" and columns 27 through 36 show the counts of the digits zero through nine. For each table row:
    1. set the 36 values in the array c to zero.
    2. test every byte in the "rule" to see if is located in the string tstr. If found, use the location where the byte was found in tstr to add 1 to the corresponding location in the array c. You will NOT count spaces or any punctuation characters.
    3. then, create the table row with 36 table cells where the cells contain the count values in the array c.
  5. Place the completed table in the DIV block with id="p2out".

This is the DIV block with id="p2out"

Show NO HTML. Show only the javascript for p2.