Assignment #124 SummingThreeNumbers
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: SummingThreeNumbers
/// File Name: SummingThreeNumbers.java
/// Date Finished 5/29/2016
import java.io.File;
import java.util.Scanner;
public class SummingThreeNumbers {
public static void main( String[] args ) throws Exception {
int number1, number2, number3, sum;
Scanner numbers = new Scanner(new File("3nums.txt"));
number1 = numbers.nextInt();
number2 = numbers.nextInt();
number3 = numbers.nextInt();
numbers.close();
sum = number1 + number2 + number3;
System.out.println( "Reading numbers from file \"3nums.txt\". . . . done." );
System.out.println( number1 + " + " + number2 + " + " + number3 + " = " + sum );
}
}
Picture of the output
//