Assignemnt #122 and 123rd program

Code

    ///Name: Derrick Andreasen
///Period: 7
///Program name: 123rd Program
///File name: Hund22prog.java
///Date Finished:5/6/2016        
        
        import java.io.File;
import java.util.Scanner;

public class Hund22prog {

    public static void main(String[] args) throws Exception {

        String name;
        int a, b, c, sum;

        System.out.print("Getting name and three numbers from file.....");

        Scanner fileIn = new Scanner(new File("name-and-number.txt"));

        name = fileIn.nextLine();
        a = fileIn.nextInt();
        b = fileIn.nextInt();
        c = fileIn.nextInt();

        fileIn.close();

        System.out.println("done.");
        System.out.println("Your name is: " + name);
        sum = a + b + c;
        System.out.println(a + " + " + b + " + " + c + " = " + sum);
//the program needs to compile every time there is an update to the file, which is inefficient.
    }
}

    

Picture of the output

Assignment 123