import java.io.*; import java.util.Scanner; public class File03 { public static void main(String[] args) throws IOException { File myFile = new File("inp3"); // Open file "inp3" Scanner in = new Scanner(myFile); // Make Scanner obj with opened file double x; // Variable to receive a floating point number double sum; // Running sum int N; // # items added ***** New code sum = 0.0; // Initialize ("clear the slate") N = 0; // 0 items added ***** New code while ( in.hasNextDouble() ) { x = in.nextDouble(); // Read a floating point number sum = sum + x; // Add to running total N++; // 1 more items added ***** New code } System.out.println("Average = " + sum/N); } }