ANSWERS MIS 3371 MIDTERM SPRING 2019 PARKS

1. (50 points) Forbe's magazine's "Top 100 Places for Millennials to Work" is condensed in the textarea to the left (see source here) . This textarea is named ta1 and is contained in a form named f1. The data contains the information on each of the Top 100 companies as follows:

rank followed by a ";" (ranks are 1 → 100)
company name followed by a ";"
city name followed by a "," followed by state name followed by a ";"
industry followed by a ";" (except there is no trailing ";" for the last company)

  1. retrieve the string from ta1 and store it in a variable named d.
  2. separate the string named d into a 400 element array named e using the ";"
  3. use e to create a 100 row by 4 column table using the 4 values for each company on each row
  4. count the number of companies that are located anywhere in "Texas"
  5. count the number of companies that are in the "Information Technology" industry
  6. Place:
    1. the 100 row by four column table;
    2. the count of "Texas" Companies, and
    3. the count of "Information Technology" companies
    in the DIV block with id="p1_out shown below.

Show only the javascript for p1.

this is the DIV block with id="p1_out"

 

147 HTML Color Names

red,green,blue color values
for the 147 named colors

2. (50 points) The first textarea to the left is named ta2 and is inside a form named f2. The textarea contains a string of the 147 named HTML colors separated by commas. The second textarea to the left is named ta3 and is also in the form named f2. It contains the red, green and blue intensity values for each of the 147 named colors. This textarea has 441 values (3 x 147), all separated by commas. Each named color is made up of three components: red, green and blue intensities:
  1. red intensity ranging from 0 → to 255, followed by a ","
  2. green intensity ranging from 0 → to 255, followed by a ","
  3. blue intensity ranging from 0 → to 255, followed by a "," (except the last one)
Create a table that has five columns on each row:

1. for each color (0 → 146), check the red, green and blue components. If any of the three components has an intensity value of 255, then make a new row in the table:

   a) in the first column, display the color name
   b) in the second column, set the background color of the cell to the color name and
       place a single blank in the cell. Make this column 50 pixels wide. Like this:

   <td bgcolor='color-name-goes-here' width='50'> </td>

   c) in the third column show the red intensity value (a value between 0 → 255)
   d) in the fourth column show the green intensity value (a value between 0 → 255)
   e) in the fifth column show the blue intensity value (a value between 0 → 255)
   f) count this new row

2. Place the resulting table in the DIV block with id="p2_out" followed by the count of colors with at least one r,g,b value that is equal to 255.

Show NO HTML. Show only the javascript for p2.

this is the DIV with id="p2_out"