Assignemnt #128

Code

          /// Name: Holden Ganch
          /// Period: 7
          /// Program Name:  Fourty first Program
          /// File Name: Using.java
          /// Date Finished: 11/3/2015


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

public class Summing {

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

        System.out.print("Which File do you want? ");
        file = kb.next(); 

        Scanner reader = new Scanner(new File(file));
        int total = 0;
        while (reader.hasNext()) {
            int a = reader.nextInt();
            System.out.print(a + " ");
            total = total + a;
            
            
        }
        System.out.println("Your total is " + total);

    }
}



    

Picture of the output

Assignment 128