Assignemnt #122 and Data from a File

Code

    
      ///name: Nick Cerdan
    ///period: 6
    ///Program name: Data From a File
    ///file name: DataFromAFile.java
    ///date finished: 2/9/16
    
    import java.io.File;
    import java.util.Scanner;
    
    public class DataFromAFile {
    
        public static void main(String[] args) throws Exception {                
            
            String name;
            int a, b, c, d, 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();
            d = fileIn.nextInt();
    
            fileIn.close();
    
            System.out.println("done.");
            System.out.println("Your name is: " + name);
            sum = a + b + c + d;
            System.out.println(a + " + " + b + " + " + c + " + " + d + " = " + sum);
        }
    }
    
    ///using this type of Scanner may cause a problem because, from what I see from this program, you can only import form one file or what the next int, or double, or whatever value. you can't skip one and go to the next next Int.

    
    Assignment 120