CST 131 -- Final Exam

Beginning with your "takehome" code that meets the specifications for Test 4 and Test 3,
add the following buttons with click-event handlers to do what is specified below:

  1. DOWN
    Sort the parallel arrays using the integer array as the key, but in DESCENDING order (from highest to lowest).

  2. ODDS
    Clear the output area, then list only those rows that have an ODD value in the integer array.
    Also compute the mean average of the odd values, and display it. (Use appropriate type.)
    (To compute the mean, just add up the odd values, then divide by the number of values.

  3. PAIRS
    Examine both arrays (integer and string), and report the number of "pairs" that are out of order in each array.

    "Out of order" means that the value of an element is greater than the value of the next (higher-subscript) element of the array. Do NOT sort the array or swap any elements.


  4. MEDIAN
    Compute the "median" of the integer values, and display it.

    To compute the median, you must first sort the array. (Do not assume that the SORT button has been clicked. However, you may re-use any methods in your code.)
    Then, if the number of elements in the array is ODD, simply use the value in the middle; if there is an EVEN number of elements, then take the two values in the middle and use their mean average.


  5. MODE
    Compute the "mode" of the intgeger values, and display it.

    The "mode" is the most common value (if any).
    One way to find the mode is to first sort the array, then look for duplicates (consecutive elements with the same value). If you find two or more elements with the same value, count how many of them there are and save the value that appears the most often.

    If no value appears more than once, then there is no "mode". If that happens, say so. (But don't not bother checking to see if the set is "bimodal" or "multi-modal".)



NOTE:   "Quality of coding" is worth up to TWO letter-grades (plus or minus). This includes: