Assignemnt #124 and Summing Three Numbers
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Summing Three Numbers
/// File Name: SummingThreeNums.java
/// Date Finished: 5/12/2016
import java.util.Scanner;
import java.io.File;
public class SummingNums
{
public static void main(String[] args) throws Exception
{
int num1, num2, num3;
Scanner fileIn = new Scanner( new File("3nums.txt"));
num1 = fileIn.nextInt();
num2 = fileIn.nextInt();
num3 = fileIn.nextInt();
int sum = num1 + num2 + num3;
System.out.print("Reading numbers from file \"3nums.txt\"...");
Thread.sleep(500);
System.out.println("done.");
System.out.println(num1 + " + " + num2 + " + " + num3 + " = " + sum);
fileIn.close();
}
}
Picture of the output