The finished program is given below.
Here is the finished program:
import java.io.*;
class AddUpFile
{
public static void main ( String[] args ) throws IOException
{
int value;
int sum = 0; // initialize sum
String line;
BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
int count = 1; // initialize count
while ( count <= 100 )
{
System.out.println("Enter a number:");
line = stdin.readLine();
value = Integer.parseInt( line.trim() );
sum = sum + value; // add to the sum
count = count + 1; // increment count
}
System.out.println( "Grand Total: " + sum );
}
}
If you run this program as is you will have to enter 100 integers. This could be tedious. For testing purposes you can change the "100" to a smaller number.