getTotalSnowFall : returns the total sum of the array

getAverageSnowFall : returns the average of the array

getHighestMonth : returns the index of the month containing the highest snowfall

getLowestMonth : returns the index of the month containing the lowest snowfall

getSnowAt : returns the value that is stored in the index of the high and low

The first four methods I believe I have done perfectly, I'm not sure about the last one getSnowAt, is my logic correct, is it returning the value its supposed to?

Brings me to my next error, at the moment I'm only getting one error in my getSnowAt method. I'm not really sure how to return the value that is indexed in the 'high' and 'low' indexes of the methods..

THe error I have is: "cannot find symbol"

return thisYear[index]; ^

Here is the SnowfallDemo

public class SnowfallDemo { public static void main(String[] args) { // Create an array of snowfall figures. double[] thisYear = {1.6, 2.1, 1.7, 3.5, 2.6, 3.7, 3.9, 2.6, 2.9, 4.3, 2.4, 3.7 }; int high; // The high month int low; // The low month // Create a SnowFall object initialized with the figures // stored in the thisYear array. Snowfall r = new Snowfall(thisYear); // Display the statistics. System.out.println("The total snowfall for this year is " + r.getTotalSnowFall()); System.out.println("The average snowfall for this year is " + r.getAverageSnowFall()); high = r.getHighestMonth(); System.out.println("The month with the highest amount of snow " + "is " + (high+1) + " with " + r.getSnowAt(high) + " inches."); low = r.getLowestMonth(); System.out.println("The month with the lowest amount of snow " + "is " + (low+1) + " with " + r.getSnowAt(low) + " inches."); } }

Here is my class

public class Snowfall { private double[] thisYear; //References array data public Snowfall (double[] y) { thisYear = new double[y.length]; for (int index = 0; index < y.length; index++) thisYear[index] = y[index]; } //Get method that returns total snowfall. public double getTotalSnowFall() { double totalSnowFall = 0.0; //Accumulator //Add up the values from the array for (double value : thisYear) totalSnowFall += value; //return the total return totalSnowFall; } //Average monthly snowfall public double getAverageSnowFall() { return getTotalSnowFall() / thisYear.length; } //Find month with most and least amount of snow public double getHighestMonth() { //Highest amount //Store first value in array in the variable highest. double high = thisYear[0]; //Search array for high value for (int index = 1; index < thisYear.length; index++) { if (thisYear[index] > high) high = thisYear[index]; } //Return value thats highest return highest; } public double getLowestMonth() { //Lowest amount double low = thisYear[0]; //Search array for low value for (int index = 1; index < thisYear.length; index++) { if (thisYear[index] < low) low = thisYear[index]; } //Return low value return lowest; } public double getSnowAt() { return thisYear[index] } }

I was getting more errors but hopefully I have fixed the up for the moment.