EXAM 1 ANSWERS MIS 3371 Summer 2017 Parks

WORLD CHESS FEDERATION TOP 100 PLAYERS
this is DIV with id=p1out
1. (50 points) The textarea to the left is named ta1 and is in a form named f1. It contains a list of the World Chess Federation's Top 100 Chess Players in the World in July 2017. Data for each player is:
  • Rank (followed by a ";")
  • Last Name, First Middle Name(s)(followed by a ";")
  • Country Code (followed by a ";")
  • Rating (followed by a ";")
  • Birth Year (followed by a "*")
    except the last one

When the button below is clicked, a javascript for function named p1 is executed that:

  1. retrieves the data from ta1
  2. creates a 100 row x 5 column table and places the table in the DIV block with id="p1out".
  3. Following the table:
    1. accumulate list of grand masters' names with Country Code = "USA"
      Show only entire name of each grandmaster on a single line
    2. show the total number number of grand masters with Country Code = "USA"

Show NO HTML. Show only the javascript for p1.


TOP 100 JOBS in HOUSTON 2017

 

this is DIV with id=p2out
2. (50 points) In the textarea to the left (named ta2 in a form named f2) is the federal 'Bureau of Labor Statistics' top 100 highest paid jobs in Houston in 2017. Each of the 100 job categories listed contains:
    1. rank (followed by a ",")
    2. job description (followed by a ",")
    3. average salary (followed by a ",")
    4. average entry level salary (followed by a ",")
    5. number of jobs in houston (followed by a ";" except the last one)
When the user enters a search value in the textbox (named sb in the f2 form) and clicks on the button labelled "search", the function named p2:
  1. retrieves the data from ta2
  2. splits the data on the ";"
  3. finds and stores each of the 100 'job description' values (item 2 above) in upper case in a 100 element array named jobs Use .toUpperCase() to convert the 'job description' values to upper case
  4. retrieves the value in the search box named sb
  5. converts this textbox value to upper case
  6. starts an output string like this: os="Search found:"
  7. examines all the 100 array elements in jobs, if an array element of jobs contains the search term, add: a break tag and the 'job description' value to os
  8. counts the number of search matches and adds the count to os
  9. places os in the DIV block with id="p2out"
The data in bold (shown to the left) is the contents of the DIV with id="p2out" resulting from searching for the term "computer" and finding 8 occurrences (i.e., executing the function named p2)
Show no HTML. Show only the javascript for p2.