MIS 3371 MIDTERM FALL 2017 PARKS
1. (50 points) The 'Top 100 Largest For-Hire Carriers in North America' are shown in the textarea to the right (from here). The textarea is named ta1 which is in a form named f1. For each trucking company the following data is provided:
     1. rank in 2017 (followed by a semicolon)
     2. rank in 2016 (followed by a semicolon)
     3. company name as a link (followed by a semicolon)
     4. revenue ($K)(followed by a semicolon)
     5. net income ($K) (followed by a semicolon)
     6. employees (followed by a semicolon)
     7. number of tractors (followed by a semicolon)
     8. number of trailers (followed by a question mark-- except the last one)
Missing values in the original data are shown by a single minus sign.
The string os contains the heading row and has been predefined in the code.
Write the javascript function named p1() that:
   1. Retrieves the trucking company data from the textarea.
   2. Creates a 100 row by 8 column table showing the data for each company
        For any item with a single minus sign, place a blank in the output table cell.
        (There are negative numbers in the financial data. Don't replace those)
   3. Find the company with the greatest increase in rank between 2016 and 2017
        Do not consider companies where the 2016 rank is a minus sign
   4. Find the average company revenue
         (remember to remove the commas in the revenue amount before adding)
   5. Place in the SPAN block with id="p1_out":
      (a) the 100 x 8 table;
      (b) the "Average Company Revenue";
      (c) the link of the company that has biggest increase in rank,
         and its old and new ranks
Show only the javascript for p1.
this is the p1_out SPAN block
2. (50 points) On the Ansel Adams' website original photographs of his most famous images of the American west are for sale. The textarea shown to the left (named ta2 in a form named f2) contains 53 images that are for sale on the site. The data for each image is:
1. the complete img tag for the photograph followed by a semicolon
2. the title of the photograph followed by a semicolon
3. the price of the photograph (if unknown, the value "? price" is shown)
   each photograph string ends with a "*" except the last one.
Assume a global array named itags has been defined as: var itags = [ ] ;
Write the javascript program named p2 that:
1. retrieves the data from ta2
2. creates a 1 row by two column outer table
3. in the first cell of the outer table: place a 53 row by 3 column table:
As each row is processed, store the img tag in the itags array
(use the row number 1 → 53 as the index)
   in the 1st cell of each row, show the row number (1 → 53)
   in the 2nd cell of each row, show the title and the price in parentheses
   in the 3rd cell of each row, place a button using a string like this:

   "<input type='button' value='View' onclick='p3(" + rownumber.toString() + ")'>"

   NOTE: in the line above rownumber is from 1 → 53
4. in the second cell of the outer table place a DIV with id="a_out"
5. place this 1 row by two column outer table into the SPAN with id="p2_out"
Assume the function p3 has been written to display the image (Do NOT write this):
   function p3(rownum) {    a_out.innerHTML=itags[rownum];  }
Show NO HTML. Show only the javascript for p2.

this is the SPAN with id="p2_out"