//This acitivity is all about two Dimensional array by CHRISTIAN KENT CALAYCAY Date: Sept. 20, 2023 import java.util.Scanner; public class TempACALAYCAY { public static void main(String[] args) { double[][] temperatureData = new double[12][2]; getData(temperatureData); double averageHigh = averageHigh(temperatureData); System.out.println("Average High Temperature of the Year: " + averageHigh); double averageLow = averageLow(temperatureData); System.out.println("Average Low Temperature of the Year: " + averageLow); int indexHighTemp = indexHighTemp(temperatureData); double highestTemp = temperatureData[indexHighTemp][0]; System.out.println("Highest Temperature of the Year: " + highestTemp + " in month " + (indexHighTemp + 1)); int indexLowTemp = indexLowTemp(temperatureData); double lowestTemp = temperatureData[indexLowTemp][1]; System.out.println("Lowest Temperature of the Year: " + lowestTemp + " in month " + (indexLowTemp + 1)); } public static void getData(double[][] data) { Scanner scanner = new Scanner(System.in); for (int i = 0; i < data.length; i++) { System.out.println("Enter high temperature for month " + (i + 1) + ": "); data[i][0] = scanner.nextDouble(); System.out.println("Enter low temperature for month " + (i + 1) + ": "); data[i][1] = scanner.nextDouble(); } } public static double averageHigh(double[][] data) { double sumHigh = 0; for (int i = 0; i < data.length; i++) { sumHigh += data[i][0]; } return sumHigh / data.length; } public static double averageLow(double[][] data) { double sumLow = 0; for (int i = 0; i < data.length; i++) { sumLow += data[i][1]; } return sumLow / data.length; } public static int indexHighTemp(double[][] data) { int index = 0; double highestTemp = data[0][0]; for (int i = 1; i < data.length; i++) { if (data[i][0] > highestTemp) { highestTemp = data[i][0]; index = i; } } return index; } public static int indexLowTemp(double[][] data) { int index = 0; double lowestTemp = data[0][1]; for (int i = 1; i < data.length; i++) { if (data[i][1] < lowestTemp) { lowestTemp = data[i][1]; index = i; } } return index; } }