Assignemnt #124: Summing Three Numbers

Code

    /// Name: Cassie Rapp
    /// Period: 6
    /// Program Name: Summing Three Numbers
    /// File Name: SummingThree.java
    /// Date Finished: 6/9/2016
    
    import java.io.File;
    import java.util.Scanner;
    
    public class SummingThree {
        
        public static void main( String[] args ) throws Exception {
            
            int number1, number2, number3, sum;
            
            Scanner numbers = new Scanner(new File("3nums.txt"));
            number1 = numbers.nextInt();
            number2 = numbers.nextInt();
            number3 = numbers.nextInt();
            
            numbers.close();
            
            sum = number1 + number2 + number3;
            System.out.println( "Reading numbers from file \"3nums.txt\". . . . done." );
            System.out.println( number1 + " + " + number2 + " + " + number3 + " = " + sum );
            
        }
    }

    

Picture of the output

Assignment 124