Homework Level: Nerd Herd Chuck, for Grade B

1.  Snow Model - Revisited

The following problem is from Homework #1.  Re-do the problem except create a method that takes E, A, S, and C as input parameters and returns the predicted snow depth as a double.  Remove all of the textboxes and place only a single button on your form.  The button click event handler should invoke your method three times, once with each successive set of values below, and output the corresponding predicted snow depth:

• E = 300, A = 180, S = 25, C = 90
• E = 300, A = 140, S = 10, C = 40
• E = 750, A = 45, S = 5, C = 25

---- Original Problem ----

Hanley and Spalinger developed the following snow model to predict how much snow will collect on a mountain slope.  The snow depth predictions were then used to determine how much food is available for moose to eat during winter which was subsequently used to calculate how many moose could survive in a particular area.

The base snow depth B in centimeters is calculated by:

• B = 10.3 + (0.27) * E
• Where E is the elevation in meters.

The base snow depth says that the higher up you go, the more snow there will be.  We can refine this calculation by including the effects of aspect (north or south facing), slow (how steep the area is), and the canopy coverage (how much the area is covered by trees).

The predicted snow depth D in centimeters using these factors is:

• D = B * Aspect * Slope * CanopyCoverage

The effect of aspect is that south-facing slopes get more sun than north-facing slopes, so there is less snow with a more southerly and exposed aspect.  Aspect is calculated by:

• Aspect =  1 + (0.33)*Cosine(A)*Tangent(S)
• Where A is the aspect in degrees (180 is due south), and S is the slope in degrees (0 to 45).

The effect of slope is that steep slopes get less snow than flat slopes.  Slope is calculated by:

• Slope = Cosine(S)
• Where S is the slope in degrees (0 to 45)

The effect of overstory canopy coverage is calculated by:

• CanopyCoverage = (100-(0.0025*eC/10 ))/100
• Where C is a number that ranges from 0 (no canopy) to 100 (complete coverage)

For example, an area at 300m elevation, 180 degree aspect (due south), 25 degree slope, and 90% overstory canopy coverage would have a predicted snow depth of about 55.8 cm.

2.  Rolling a pair of dice

Create a void method that simulates rolling two six sided dice.  The method should take two integer reference parameters as input, assign each one a random number between 1 and 6, and return.  Write code of your choice that tests the method to make sure that it is working by outputting the returned dice values.

3.  The Longest Palindrome

Right-click and save the following file to your computer:  bigwords.txt.  It contains a list of 748,920 words.  Note that the file is named "bigwords.txt".   Depending on your system settings, when you view the file in the explorer the ".txt" part may be hidden by Windows.   Don't forget to include the ".txt" when you open the file in your program.

Write a program that reads in this file and outputs the longest palindrome.  A palindrome is a word that is the same forwards as it is backwards.  Your program should output ONLY the longest palindrome, not all palindromes.

Here is a method that determines if the string passed in is a palindrome.  If so, it returns true.  If not, it returns false.

```        private bool isPalindrome(string s)
{
string sReverse = "";
for (int i = s.Length  - 1; i >= 0; i--)
{
sReverse = sReverse + s[i].ToString();
}
if (s == sReverse)
return true;
return false;
}
```