Assignemnt #128

Code

//colin hinton
//5th period
//5/27/2016
//almost.java

import java.io.File;
import java.util.Scanner;
class almost
{
    public static void main (String [] args) throws Exception
    {
        Scanner kb = new Scanner(System.in);
        System.out.println("Which file you want: ");
        String imput = kb.next();
        
        Scanner fileIn = new Scanner(new File((String) imput));
        
        
            int total = 0;
            while (fileIn.hasNext())
            {
                int print = fileIn.nextInt();
                System.out.print(print + "  ");
                total = total + print;
            }
            fileIn.close();
            System.out.println("The total is " + total);
     }
}

    

Picture of the output

Assignment 1