Assignment #124
Code
/*
jack newsom
period 5
program ThreeNumSum
filename ThreeNumSum
date completed 2/18/16
*/
import java.util.Scanner;
import java.io.File;
public class ThreeNumSum
{
public static void main( String[] args ) throws Exception {
Scanner fileIn = new Scanner(new File("3nums.txt"));
int num1, num2, num3;
System.out.print("Pulling numbers from file \"3nums.txt\"...");
num1 = fileIn.nextInt();
num2 = fileIn.nextInt();
num3 = fileIn.nextInt();
int sum = num1 + num2 + num3;
System.out.println(" done.");
System.out.println();
System.out.println( num1 + " + " + num2 + " + " + num3 + " = " + sum );
}
}
Picture of the output