MIS 3371 SPRING 2015 FINAL PARKS

Texas Property Taxes by County 1998-2013

1. (50 points) The form (named f1) to the left contains a textarea named d1 which is string of XML. The DTD for this XML is:

<?xml version="1.0"?>
<!DOCTYPE texas_taxes [
<!ELEMENT texas_taxes(county+)>;
<!ELEMENT county (name,r98,r99,r00,r01,r02,r03,r04,r05,r06,r07,r08,r09,r10,r11,r12,r13)>
<!ELEMENT name (#PCDATA>
<!ELEMENT r98 (#PCDATA)>
...omitted r99 thru r12...
<!ELEMENT r13(#PCDATA)>]>

This data (from www.county.org) shows the total property tax rates for each Texas county for the years 1998 through 2013. Assume the following code exists in the javascript function p1 that loads the string of XML shown to the left into the Microsoft XMLDOM (DO NOT write this code):
xmldata=document.f1.d1.value;
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xmldata);
var root=xmlDoc.documentElement;
1. Create a 255 row 18 column table that shows for each county (in column number):
  • (column 1) name;
  • (columns 2 through 17) county tax rate [there are 16 rates for each county 1998 thru 2013];
  • (column 18) maximum of this county's rates (of the 16 values for the county)
2. Place the resulting table in the DIV with id="p1_out".
3. After the table show: the maximum county tax rate (i.e., the maximum value in column 18) and the county name where this occurred.
Notes:
  • the value for any table cell (except column 18) is: root.childNodes[i].childNodes[j].text;
  • the number of counties is: root.childNodes.length (there are 255 counties);
  • the number of values for each county is: root.childNodes[i].childNodes.length.
Show NO HTML. Show NO heading. Show only the javascript for p1().

This is DIV with id="p1_out"
2. (50 points) The 50 most frequently words occurring in our course syllabus are stored in alphabetical order in an array named w. The corresponding frequencies of these 50 words are stored in an array named wc. There is also an array named clr that contains 8 CSS color names. Assume these three arrays are in available in the javascript function p2.

  • Find the max and min frequency in wc -- named them: cmax and cmin.
  • Create a "word cloud" in the table cell on the left (id="p2out")
  • Use the 50 word array w to make a string of words (named os)
  • Place each word in a SPAN block and set its CSS style properties:
      • white-space to normal;
      • color to the value of: clr [parseInt(Math.random( )*8)]
      • font-size to the value of: 12+parseInt(28*( wc[i]-5)/(cmax-cmin))
      • padding and margin both to: 0px
      • font-weight to bold
      • line-height to 34px
      • text-transform to uppercase
  • Place the os in the table cell with id="p2out". Use:
        p2out.innerHTML = os;

Show NO HTML. Show only the javascript for p2().