Assignment #125

Code

    /// Name: Matthew Lorence
    /// Period: 5
    
    import java.io.File;
    import java.util.Scanner;
    
    public class SummingThreeAny {
    
        public static void main(String[] args) throws Exception {
    
            Scanner keyboard = new Scanner(System.in);
            String name;
            int a, b, c, sum;
            
            System.out.print("Which file would you like to read from: " );
            String file = keyboard.next();
    
            Scanner fileIn = new Scanner(new File(file));
    
            a = fileIn.nextInt();
            b = fileIn.nextInt();
            c = fileIn.nextInt();
            
    
            fileIn.close();
    
            sum = a + b + c;
            System.out.println(a + " + " + b + " + " + c + " = " + sum);
        }
    }



        
        
    

Picture of the output

Assignment 125