125
Code
///Name: Joshua Bautista
///Period: 6
///Date: 6/4/16
import java.util.Scanner;
import java.io.File;
public class STF {
public static void main(String[] args) throws Exception{
Scanner kb = new Scanner(System.in);
Scanner fileOut1 = new Scanner(new File("3nums1.txt"));
Scanner fileOut2 = new Scanner(new File("3nums2.txt"));
Scanner fileOut3 = new Scanner(new File("3nums3.txt"));
int choice, num1, num2, num3, sum;
System.out.print("Which file would you like to draw from? (1-3) ");
choice = kb.nextInt();
if (choice == 1)
{
num1 = fileOut1.nextInt();
num2 = fileOut1.nextInt();
num3 = fileOut1.nextInt();
sum = num1 + num2 + num3;
}
else if (choice ==2)
{
num1 = fileOut2.nextInt();
num2 = fileOut2.nextInt();
num3 = fileOut2.nextInt();
sum = num1 + num2 + num3;
}
else
{
num1 = fileOut3.nextInt();
num2 = fileOut3.nextInt();
num3 = fileOut3.nextInt();
sum = num1 + num2 + num3;
}
System.out.println(num1 + " + " + num2 + " + " + num3 + " = " + sum);
}
}
Picture of the output