// Displays the first 5 numbers in the given file, // and displays their sum at the end. import java.io.*; // for File, FileNotFoundException import java.util.*; public class Echo { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("H:/Java/Eclipse Workspace/Echo/numbers.txt")); double sum = 0.0; for (int i = 1; i <= 5; i++) { double next = input.nextDouble(); System.out.println("number = " + next); sum += next; } System.out.println("Sum = " + sum); } }