Assignment #125 and Summing Three Numbers from Any File

Code

    /// Name: Brendan Baird
    /// Period: 6
    /// Program Name: Summing Three Numbers from Any File
    /// File Name: SumAnyFile.java
    /// Date Finished: 2/26/2016
    
    import java.io.File;
    import java.util.Scanner;
    
    public class SumAnyFile {
    
        public static void main(String[] args) throws Exception {
    
            int a, b, c;
            Scanner k = new Scanner(System.in);
            
            System.out.print("Which file would you like to read numbers from: ");
            String file = k.next();
            
            Scanner fileIn = new Scanner(new File(file));
    
            a = fileIn.nextInt();
            b = fileIn.nextInt();
            c = fileIn.nextInt();
    
            fileIn.close();
    
            int sum = a + b + c;
            System.out.println("\n" + a + " + " + b + " + " + c + " = " + sum);
            System.out.println();
        }
    }
    

Picture of the output

Assignment 125