Assignment #125

Code

    
    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: AnyFileSum
    ///File Name: AnyFileSum.java
    ///Date: 6/3/16
    
    
    
    import java.util.Scanner;
    import java.io.File;
    
    public class AnyFileSum
    {
        public static void main( String[] args ) throws Exception{
            
            Scanner keyboard = new Scanner(System.in);
            String choice;
            int a, b, c;
            
            System.out.print("Which file would you like to draw from: ");
            choice = keyboard.next();
            Scanner fileIn = new Scanner(new File(choice) );
            
            a = fileIn.nextInt();
            b = fileIn.nextInt();
            c = fileIn.nextInt();
            
            System.out.println( a + " + " + b + " + " + c + " = " + (a+b+c) );
        }
    }
            
            


    

Picture of the output

Assignment 125