Assignemnt #128
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Sum
/// File Name: Sum.java
/// Date Finished: 3/28/2016
import java.io.File;
import java.util.Scanner;
public class Sum {
public static void main(String[] args) throws Exception {
int a, b, c, sum;
System.out.print("Getting three numbers from file.....");
Scanner fileIn = new Scanner(new File("numbers.txt"));
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
sum = a + b + c;
System.out.println(a + " + " + b + " + " + c + " = " + sum);
}
}
Picture of the output