Professional Documents
Culture Documents
}
return a;
}
public static double[][] driest (double a[][])
{
double dryavg = 0;
int dryMonth = 0;
for (int month = 0; month < a[0].length; month++)
{
double sum = 0.0;
for (int region = 0; region< a.length; region++)
{
sum += a[region][month];
}
double average = sum/a.length;
if(month == 0)
{
dryavg = average;
}
if(average<dryavg)
{
dryavg = average;
dryMonth = month;
}
}
System.out.println("");
System.out.println("Driest month of 2015: "+ months[dryMonth]+ "\nAverage
rainfall for this month: " + dryavg);
return a;
sum += a[region][month];
}
average = sum/4;
sum = 0;
c[month] = average;
System.out.println("");
double[] added = new double[c.length];
for(int i = 0;i<added.length;i++)
{
added[i] = c[i] + b[i];
}
double max = 0;
int index = 0;
for (int x = 0; x < added.length; x++)
{
if (max < added[x])
{
max = added[x];
index = x;
}
}
if (index > 11)
System.out.println("The greatest rainfall month(s) over the two years
occured at " + months[index-12]);
if (index <= 11)
System.out.println("The greatest rainfall month(s) over the two years
occured at " + months[index]);
return a;
}
sum += a[region][month];
}
average = sum/4;
sum = 0;
c[month] = average;
System.out.println("");
String biggestChange = "";
for(int i = 0;i<b.length;i++)
{
double currentChange = Math.abs(b[i] - c[i]);
if(currentChange>biggestChangeNum)
{
biggestChangeNum = currentChange;
biggestChange = months[i];
}
else if(currentChange == biggestChangeNum)
{
biggestChange+=months[i];
}
}
System.out.println(biggestChange);
return biggestChange;
int counter=1;
for (double element: finalScores){
System.out.println("Diver number: " + counter + ": " + element);
counter++;
}
return index;
}