import java.util.Random;
import java.util.Scanner;

public class ArrayIllustration {
    public static void main(String[] args) {
        double[][] dailyTemp;
        final int days = 3, months = 3;
        dailyTemp = new double[months][days];
        Scanner s = new Scanner(System.in);
        for (int m = 0; m < months; m++) {
            System.out.println("Enter temperatures for month: " + (m+1));
            String line = s.nextLine();
            String[] temps = new String[days];
            temps = line.split(" ");
            for (int d = 0; d < temps.length; d++) {
                dailyTemp[m][d] = Double.parseDouble(temps[d]);
            }// End of days in a month
        }// End of data input
// Compute statistics
        double[] max = new double[months];
        double[] min = new double[months];
        double[] avg = new double[months];
        double[] sum = new double[months];
        for (int m = 0; m < months; m++) {
            double nextVal = dailyTemp[m][0];
            max[m] = nextVal;
            min[m] = nextVal;
            sum[m] = nextVal;
            for (int d = 1; d < days; d++) {
                nextVal = dailyTemp[m][d];
                sum[m] = sum[m] + nextVal;
                if (max[m] < nextVal) {
                    max[m] = nextVal;
                }
                if (min[m] > nextVal) {
                    min[m] = nextVal;
                }
            }// End of computation for days in a months
            avg[m] = sum[m] / days;

        }// End of processing all months
        System.out.printf("%s \t %s\t %s\t %s\n ", "Month", "Max", "Min", "Avg");
        for (int m = 0; m < months; m++) {
            System.out.printf(" %d\t\t %.2f\t %.2f \t %.2f\n ", m, max[m], min[m], avg[m]);
        }// End of printout

    }// End of main
} // End of class
