Assignemnt #125 Summing Any Numbers

Code

    /// Name: JJ Deng
    /// Period: 6
    /// Program Name:SummingThreeNumbersFromAnyFile
    /// File Name: NumAny.java
    /// Date Finished: 5/29/2016
  
        import java.io.File;
        import java.util.Scanner;
        
        public class NumAny {
        
            public static void main(String[] args) throws Exception
            {
        
                int a, b, c, sum;
                String fileName = "Num1.txt";
                Scanner keyboard = new Scanner(System.in);
        
                        System.out.print("Reading numbers from file \"" + fileName + "\":\n\n>");
        
                        Scanner fileIn = new Scanner(new File(fileName));
        
                        a = fileIn.nextInt();
                        b = fileIn.nextInt();
                        c = fileIn.nextInt();
        
                        fileIn.close();
        
                        System.out.println("done.");
                        sum = a + b + c;
                        System.out.println(a + " + " + b + " + " + c + " = " + sum);
            }
        }


    

Picture of the output

Assignment 120