MIS 3371 SUMMER 2019 PARKS MIDTERM

1. (50 points) The data to the left is in a textarea named ta1 and is contained in a form named f1. The data in the textarea (from here) is the top 25 business schools' average graduate admission test scores (GMAT) for accepted students (i.e., these students applied, and were admitted based on their GMAT score). These average test scores for each school are recorded for each of the past five years (2014 to 2018). The data for each school is:
  1. rank (from 1 to 25) followed by a comma
  2. university (School Name) followed by a comma
  3. average 2018 GMAT score followed by a comma
  4. average 2017 GMAT score followed by a comma
  5. average 2016 GMAT score followed by a comma
  6. average 2015 GMAT score followed by a coma
  7. average 2014 GMAT score followed by a comma
  8. trend (5 year change) followed by a ";" (except there is no ";" for the last school)
Write the javascript function named p1 that will:
  1. retrieve the data from ta1 and store it in a variable named g.
  2. separate g into a 25 element array named school using the ";"
  3. create a 27 row by 8 column table. Right justify columns #1 and #3 through #8.
  4. the string my_head already contains the headings for the first row [don't write the headings, just use my_head]
  5. place the data into the eight columns of rows #2 through #26 of the table
  6. calculate the averages of the last six (right-most)columns of the table. Use the following array:
          var averages = new Array(0,0,0,0,0,0)
  7. On the 27th row:
    1. place a blank in the 1st column
    2. place the string: "AVERAGE" in the second column
    3. place the six averages you calculated in the 3rd through the 8th columns
  8. place the table in the DIV block with id="p1_out"

Show no HTML. Show only the javascript for p1.

this is the DIV block with id="p1_out"

Top 1,000 Most Common Surnames
[Last Names] in the United States

[Data from mongabay.com]
2. (50 points) The data shown to the left is the top 1,000 USA surnames (i.e., last names). The data is contained in a textarea named ta2 in a form named f2. Each surname's data is followed by a "*" (except the last one). There are 15 pieces of data for each surname followed by a comma (except the last one). The 15 data fields are:
  1. Surname (all upper case)
  2. Rank (1 → 1000)
  3. Count
  4. Number per 100,000
  5. % White
  6. % Black
  7. % Asian Pacific Islander
  8. % Native American and Alaska Natives
  1. % 2 or More Races
  2. % Hispanic Origin
  3. Rank in 2000
  4. Count in 2000
  5. Change since 2000
  6. % Change since 2000
  7. Rank change since 2000
Write the javascript for a function named p2 that:
  1. retrieves the data from ta2
  2. produces a 1001 row by 15 column table of the data. Place the table in the DIV with id="p2_out". The first row (row #1) is a heading which has been pre-written and named hdg (Do not write the heading, just use hdg)
  3. in row #2 through #1,001 place the data for the each surname's 15 columns. Align the contents of column 1 to the left. Align all other columns to the right. There are 1,000 surname rows.
  4. find the surname with the largest gain in "rank change since 2000" column (this is the data in the last column)
  5. find the surname with the smallest gain in "rank change since 2000" column (this is the data in the last column)
  6. after the table has been displayed:
    1. place the largest "rank change since 2000" and the surname on a line by itself, and
    2. place the smallest "rank change since 2000" and the surname on a line by itself

Show NO HTML. Show only the javascript for p2.
this is the DIV block with id="p2_out"