Assignment 124, Summing Three Numbers
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Summing Three Numbers
///File Name: Data3.java
///Date Finshed: 6/06/16
import java.io.File;
import java.util.Scanner;
public class Data3 {
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("3nums.txt"));
a = fileIn.nextInt();
b = fileIn.nextInt();
c = fileIn.nextInt();
fileIn.close();
sum = a + b + c;
System.out.println(a + " + " + b + " + " + c + " = " + sum);
}
}
Picture of the output