Code
///Name: Joshua Bautista
///Period: 6
///Date: 6/4/16
import java.util.Scanner;
import java.io.File;
public class SSN {
public static void main(String[] args) throws Exception {
Scanner kb = new Scanner(System.in);
System.out.println("Which file would you like to add from?");
System.out.print("> ");
String file = kb.next();
System.out.println("");
while (file.equals("5nums.txt") || file.equals("6nums.txt") || file.equals("7nums.txt") || file.equals("8nums.txt")) {
Scanner reader = new Scanner(new File(file));
int total = 0;
while (reader.hasNext()) {
int a = reader.nextInt();
System.out.print(a + " ");
total = total + a;
}
System.out.println("Total: " + total);
System.out.println("");
System.out.println("Which file would you like to add from?");
System.out.print("> ");
file = kb.next();
System.out.println("");
}
}
}
Picture of the output