I have to finish this method that returns the sum of the CDD calculations over a whole month. My cdd method that I use to calculate the sum is below first. Can I get a hint as to how to go about this? I struggle with arrays and I'm unsure of how to start.
public static double cdd(int max, int min)
{
double average = ((max + min) / 2.0);
double cdd = 0.0;
if (average > 65.0)
{
cdd = average - 65.0;
}
else
{
cdd = 0.0;
}
if (max == -999 || min == -999)
{
cdd = 0.0;
}
else if (max < min)
{
cdd = 0.0;
}
return cdd;
public static double monthCdd(int[] max, int[] min)
{
double sum = 0.0;
max = new int[31];
min = new int[31];
cdd(,);
return sum;
}
maxandminboth have data elements in them, so where does this data come from? Do you make it up? Or what?