ChoiceNum

Code

import java.io.File;
import java.util.Scanner;

public class ChoiceNum {

    public static void main(String[] args) throws Exception {
        
        Scanner keyboard = new Scanner(System.in);

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

        System.out.println("Getting name and three file.....");
        System.out.println("1.3nums1.txt, 2.3nums2.txt, 3.3nums3.txt (type the name) " );
        name = keyboard.next();

        Scanner fileIn = new Scanner(new File( name ));
        
        a = fileIn.nextInt();
        b = fileIn.nextInt();
        c = fileIn.nextInt();
        
        fileIn.close();
        
        sum=a+b+c;
        
        System.out.println( a + "+" + b + "+" + c + "= " + sum );
        
    }
}

ChoiceNum

Assignment 125