MIS 3371      MIDTERM EXAM     FALL 2020      PARKS

1. In IE click FILE, then SAVE AS...
      or in other browsers
    right click this page. The "Save as..." dialog should appear
2. Save this file as "f20mxxxxxxx.htm" where xxxxxxx is your seven digit Peoplesoft ID
3. Open this file in an ASCII text editor (NOT MS WORD)
4. In the heading section of this file you will:
    1) Type your personal data (LastName, FirstName, PSID and Email) in the indicated places
    2) Type your two exam answers in the two indicated places
5. When finished:
    save this file (including your personal data and two answers) as "f20mxxxxxxx.htm"
    where xxxxxxx is your seven digit Peoplesoft ID
6. Email me ( parks@uh.edu ) -- with this file attached
    In the SUBJECT field type: f20mxxxxxxx.htm
    where xxxxxxx is your seven-digit PeopleSoft ID

    Before WEDNESDAY 5:20 PM OCTOBER 14, 2020

The ratings for the 'Top 100 Cars of All Time' from Edmunds by John Pearley Huffman, Listmaster, August 16th, 2011 is contained in the textarea to the left named 'topcars'. This textarea is in a form named 'top100carform' and contains the 100 car ratings.

Each car has a:

     rank (from 100 → 1) followed by a semicolon
     year followed by a semicolon
     manufacturer followed by a semicolon
     model followed by a semicolon
     description followed by a semicolon (except for the last one)

The sections below describe the requirements for problem 1 and problem 2.

 Problem 1 (50 points). Write the function named p1 in javascript that will:
  1. Retrieve the data from the textarea named topcars
  2. Create a 102 row by five column table. The table should have:
    1. a two-line title row (centered and bold faced ) that says:
         TOP 100 CARS OF ALL TIME
         from Edmunds by John Pearley Huffman, Listmaster, August 16th,2011
    2. a row with five column heading values: (1) RANK; (2) YEAR; (3) MANUFACTURER; (4) MODEL; and (5) DESCRIPTION
    3. A row for each of the 100 cars containing columns with the values for: rank; year; manufacturer; model and description.
  3. Find the minimum and maximum YEAR
  4. When completed, place: (1) the table; (2) the minimum year, and (3) the maximum year in the DIV with id="ans1"

    Show answer

 Problem 2 (50 points) Write the javascript function named p2 that will produce a two column table (using the same textarea data used above in Problem #1). Assume p2 contains an alphabetized array named man_array that contains all the manufacturer's names:

   man_array = ["Acura","Aston-Martin","Audi","Austin", ... (many names omitted here) ... "Shelby","Subaru","Toyota","Volkswagen"];

The p2 should:

  1. Initialize an array of counters to zero (this array should have the same number of elements as man_array)
  2. Loop through the car data:
    for each car, find the car's MANFACTURER value in the man_array and then add 1 to the corresponding value in the counters array.
  3. Create a two column table (headings shown are not required). Each row contains:
    1. the value man_array in the first column
    2. the corresponding count in the second column
  4. Following the table, show the name of the MANUFACTURER with the largest number of occurrences; and that maximum number of occurrences.
  5. When completed, place the output in the DIV with id="ans2"

    Show answer