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:

---- 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:

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:

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:

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

The effect of overstory canopy coverage is calculated by:

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;