public class ArrayExample { public static void main(String[] args) { int[][] temperatures = { { 73, 71, 68, 69, 69, 77, 78 }, { 76, 73, 72, 72, 75, 79, 76 }, { 79, 82, 84, 84, 81, 78, 78 }, { 75, 72, 68, 69, 65, 63, 63 }}; //This give me the weekly average. int row,column,total; int week = 1; for(row = 0;row < temperatures.length;row++) { total = 0; int average = 0; for(column = 0;column < temperatures[row].length;column++) { total = total + temperatures[row][column]; } average = total / temperatures[row].length; System.out.println("Week "+week+" average temperature is " + average + "."); week++; } System.out.println(); //This gives me the daily average. int day = 1; for(column = 0;column < 7;column++) { total = 0; int average = 0; for(row = 0;row < temperatures.length;row++) total = total + temperatures[row][column]; average = total / temperatures.length; System.out.println("Day "+ day +" average temperature is "+ average + "."); day++; } System.out.println(); //This gives highest and lowest temperatures for each week. int week2 = 1; int highest = temperatures[0][0]; int lowest = temperatures[0][0]; for(row = 0;row < temperatures.length;row++) { total = 0; for(column = 0;column < temperatures[row].length;column++) { if(temperatures[row][column] >= highest) highest = temperatures[row][column]; else if (temperatures[row][column] >= lowest) lowest = temperatures[row][column]; } System.out.println("Week "+week2+" highest temperature is " + highest + "."); System.out.println("Week "+week2+" lowest temperature is " + lowest + "."); week2++; } System.out.println(); //This gives highest and lowest temperatures for each day. int day2 = 1; int highest2 = temperatures[0][0]; int lowest2 = temperatures[0][0]; for(column = 0;column < 7;column++) { for(row = 0;row < temperatures.length;row++) if (temperatures[row][column] > highest2) highest2 = temperatures[row][column]; else if (temperatures[row][column] < lowest2) lowest2 = temperatures[row][column]; System.out.println("Day "+ day2 +" highest temperature is "+ highest2 + "."); System.out.println("Day "+ day2 +" lowest temperature is "+ lowest2 + "."); day2++; } System.out.println(); //This gives me the total sum of the array. int total2 = 0; for(row = 0;row < temperatures.length;row++) { for(column = 0;column < temperatures[row].length;column++) total2 = total2 + temperatures[row][column]; } System.out.println("Total sum of the array is " + total2 + "."); } }