import java.util.*; import java.io.*; public class Midterm { public static void main(String[] args) throws FileNotFoundException { Scanner console = new Scanner(System.in); System.out.print("Input file? "); String fileName = console.nextLine(); Scanner input = new Scanner(new File(fileName)); // read in scores (first number in file is number of scores) // compute average score int total = 0; int numScores = input.nextInt(); int[] scores = new int[numScores]; for (int times = 0; times < numScores; times++) { scores[times] = input.nextInt(); total += scores[times]; } double average = (double)total / numScores; System.out.println("Average score: " + average); } }