Hi I am trying to create the following method in C# Create a method last3YearInInches. It should take in an ArrayList (Java) or List (C#) of Doubles.
■ If the size of the list is less than 3, return 100
■ Otherwise take the LAST 3 items in the list and average them together.
■ Return the average
This is what I have to far but I am getting errors when trying to use only the last three of the list.
public double last3YearsInInches(List<Double> list )
{
if(list.Count < 3)
{
return 100;
}
else
{
double lastThree= list.Reverse<Double>().Take(3);
double average = lastThree / 3;
return average;
}
}