FALL 2015 MIS 3371 -- PARKS -- MIDTERM ANSWERS

This is the DIV with id="p1out"

Data from: www.greatplacetowork.com

1. (50 points) The Top 100 Best Places to work are shown to the right in a form named f1 in a textarea named ta1. For each of the 100 companies, the following data is shown:
   1. rank (from 1 → 100) followed by a "*"
   2. company name followed by a "*"
   3. number of employees followed by a "*"
      CAUTION: Some companies do not report their number of employees.
      The value "Confidential" is used rather than a number.
   4. industry followed by a "*"
   5. company type followed by a "*"
   6. state followed by a "#"
      (except the last company which does NOT end with a "#")
Assume that the 14 possible values of the industry field are stored in an array named ind.
Assume there is a 14 element array named inc that has been initialized to 0 to count the number of companies in each industry in the data
Assume there is a 14 element array named emc that has been initialized to 0 to accumulate the number of employees in each industry
Do NOT write these 3 arrays on your exam.
Create a 14 row, 3 column table that contains:
   1. in column 1 the name of the industry from the ind array
   2. in column 2 the number of companies found in the industry
   3. in column 3 the total number of employees for all companies in the industry
When completed, place the table in the DIV block with id="p1out".
When the user clicks the "Execute p1" button , the javascript function named "p1" is executed.
Show NO HTML. Do NOT write a table heading row at the top of the table in the answer. Write only the javascript for the function p1.

 

This is the SPAN block with id="p2out"

2. (50 points) The single image of the U.S.A. flag is shown to the left. Create a new flag using a 13 row table. Use a beginning table tag that has the two attributes: cellspacing='0' and cellpadding='0'. The table will contain four different types of rows. Assume the following array is defined in your code:
   var row= new Array(4);
Use this row array to store four strings that represent the HTML for 4 different types of rows:
Row type 0: has two cells:
   cell 1 has 6 images with src='star.png' and height='8'. All the images centered in the cell.
   cell 1 has width='99' and bgcolor='rgb(0,0,64)' (a dark blue)
   cell 2 has width='148' and bgcolor='rgr(200,0,0)' (deep red) and contains a single blank character
Row type 1: has two cells:
   cell 1 has 5 images with src='star.png' and height='8'. All the images are centered in the cell,
   cell 1 has width='99' and bgcolor='rgb(0,0,64)'
   cell 2 has width='148 and bgcolor='rgb(235,235,235)' (a dull white) and contains a single blank character
Row type 2: has one cell with colspan='2' width='247' height='8' and bgcolor='rgb(235,235,235)'
   the cell contains a single blank character
Row type 3: has one cell with colspan='2' width='247' height='8' with bgcolor='rgb(200,0,0)'
   the cell contains a single blank character
Assume the following array is defined in your code:
   var rowseq=new Array(0,1,0,1,0,1,0,2,3,2,3,2,3);
Use rowseq to define the sequence of the 13 rows in the table.
Place the HTML for the table in the SPAN block with id="p2out".
Show NO HTML. Show only the javascript for p2.