The program can add up however many integers there are in the file. The user does not need to know how many that is. The data itself says how many integers to add up.
Here is the program, except for a blank or two:
import java.io.*; class AddUpAll { public static void main ( String[] args ) throws IOException { int value; // the value of the current integer int limit; // the number of integers to add up int sum = ________; // initialize sum String line; BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) ); // get the number of integers to add up System.out.println("Enter how many integers:"); line = stdin.readLine(); limit = Integer.parseInt( line.trim() ); int count = ________; // initialize count while ( count <= _______ ) { System.out.println("Enter a number:"); line = stdin.readLine(); value = Integer.parseInt( line.trim() ); sum = ____________; // add to the sum count = ____________; // increment count } System.out.println( "Grand Total: " + sum ); } }