Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.

For each of the exercises below, write a driver program that asks the user how many values they would like to analyze, and then populates an appropriate array with values entered by the user. Finally, test the method written for the exercise using the user-input array.

1. When people talk about an average value, most often they are referring to the arithmetic mean (sum of the values, divided by the number of values). There are, however, other “measures of central tendency.” For example, the geometric mean of a sequence of n values is the nth root of the product of all the values. A simple algorithm to compute the geometric mean of a sequence of values is

Algorithm
Let `n` be the number of values in the sequence.
1. Given:
• `values` is a sequence with at least one value.
2. Initialize `gMean` to 1.
3. For each ``` value i ```:
Set `gMean` to be the product of `gMean` and ``` value i ```.
4. Return the `n`th root of `gMean`.

Write a method that computes the geometric mean of an array of values. Test this method by using it to compute and display the geometric mean of data input by the user. Be sure to include appropriate documentation. Hint: To compute the `n`th root of a value x you can use `Math.pow(x, 1.0/n)`

2. While a mean tells you something about the central tendency of your data, the standard deviation instead measures the amount of variability or diversity in your data.

To compute a complete population's standard deviation, you can use the following algorithm:

Algorithm
Let `n` be the number of values in the sequence.
1. Given:
• `values` is a sequence with at least one value.
2. Initialize `mean` to be the average of `values`.
3. Initialize `discriminant` to be 0.
4. For each ``` valuei ```:
Set `discriminant` to be the sum of `discriminant` and ``` (valuei - mean)2 ``` .
5. Set `discriminant` to be `discriminant / n`
6. Return the square root of `discriminant`.

Write a method that computes the standard deviation of an array of values. Test this method by using it to compute and display the standard deviation of data input by the user. Be sure to include appropriate documentation.

3. A histogram counts the number of times each of the numeric values occur. Usually we see histograms as a graph:

```74: ***
75: *****
76: ******
77:
78: **
```

This graph of the histogram indicates that the value 74 was seen three times, the value 75 was seen five times, 76 seen six times, 77 seen zero times, and 78 seen two times. All other values were never seen.

Write the following two methods:

• `computeHistogramGraph()` receives an array of numeric scores and counts the number of times that particular numeric scores occur in the given array. The method returns an appropriate string, formatted as shown above. Note that you should include only the values between the minimum and maximum scores (inclusive).
• `computeHistogramTable()` displays the raw histogram data; for example:
```74:3 75:5 76:6 78:2
```

Here, you skip all values with a 0 count.

Test both of these methods using an array whose values were received from the user. Be sure to include appropriate documentation.

4. Extend the lab exercise by designing and implementing an algorithm for a method that counts the number of each unique words in a text. The method should receive an array of words and print out each unique word along with a number of occurrences of that word in the array.

Refer to the previous question for a discussion of histograms. Your instructor will indicate whether you should print numbers for the counts or histogram bars.

5. Write a method that receives an array of city names, low and high temperatures (see for example, weatherStats.java) and returns an array of four Strings with the following statistics:

• The highest high temperature
• The lowest high temperature
• The highest low temperature
• The lowest low temperature

In each case, concatenate the value together with the name of the city that produced it (e.g., "Grand Rapids 72"). If there are ties, you may arbitrarily decide which city name to report). Print the resulting array, one statistic per line.

Be sure to test your method using the constant in weatherStats.java (copy and paste it to the bottom of your class as we did in lab), and print the resultant array, one statistic per line.

# Checking In

Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria:

• Correctness:
• 40% - Basic functionality - Include the basic animation or interaction behavior.
• 40% - Array Handling - Include the required array handling behavior.
• Efficiency:
• 10% - Conciseness - Use clear, concise and efficient array handling techniques.
• Understandability:
• 5% - Code Documentation - Separate the logical blocks of your program with useful comments and white space.
• 5% - Header Documentation - Document the code’s basic purpose, authors and assignment number.