/** 10/29/2018 * Problem: Read in a set of grades * 1. calculate average * 2. Find max * 3. Find min * 4. Count number of grades greater than the average. * This version is Solution 3 using Arrays * We have the advantages of both Solutions 1 and 2: * scales up and is easier to program AND data sticks around. */ import java.io.*; import java.util.Scanner; public class GradesArray { public static void main(String[] args) throws IOException { Scanner infile = new Scanner(new File("grades.txt")); // Read in data (which is a header value followed by #s) int num = infile.nextInt(); // final int SIZE = 5; double[] grades = new double[num]; // Read data values into the array grades for (int i=0; i max) max = grades[i]; else if (grades[i] < min) min = grades[i]; } // task 4: how many grades are higher than average int higherAvg=0; for (int i=0; i average) higherAvg++; } System.out.println("max: " + max + " min: " + min + " Higher than avg: " + higherAvg); } }