Assignemnt #125 sum2.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: sum2
/// File Name: sum2.java
/// Date Finished: 5/29/2016
import java.util.Scanner;
import java.io.File;
public class sum2{
public static void main(String[] args) throws Exception{
int a,b,c;
String type;
Scanner keyboard = new Scanner(System.in);
System.out.print("Which file? (Ex. \"num1.txt\"): ");
type = keyboard.nextLine();
Scanner fileIn = new Scanner(new File(type));
System.out.println();
System.out.print("Loading data from \""+type+"\".....");
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
fileIn.close();
System.out.println("DONE");
System.out.println();
System.out.println(a+"+"+b+"+"+c+"="+(a+b+c));
}
}
Picture of the output