MIS 3371 MIDTERM EXAM PARKS FALL 2020

In IE, click  VIEW  ,then  SOURCE  on the top menu bar
   or
in other browsers, right click on the page, then click  View Page Source 

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 two buttons below will show you the output of either problem 1 or problem 2 in the DIV with id="ans" shown below.


The sections below describe the requirements for problem 1 and problem 2 and provide DIVs (id="ans1" and id="ans2") for the answers.
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 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 heading 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. When completed, place the table in the DIV with id="ans1"

      

this is div with id="ans1"
Problem 2 (50 points) There is an alphabetized array named man_array that contains the manufacturer's names:

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

Write the javascript function named p2 that will produce a two column table (using the same textarea data used above in Problem #1):

  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 where 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 show that maximum number of occurrences.

this is div with id="ans2"