// Variation of HoursWorked that includes employee ID
import java.io.*;
import java.util.*;
public class HoursWorked2 {
// processes the give String(ID, name, and hours worked)
public static void processLine(String text) {
Scanner data = new Scanner(text);
int id = data.nextInt();
String name = data.next();
double sum = 0.0;
while (data.hasNextDouble()) {
sum += data.nextDouble();
}
System.out.printf("Total hours worked by %s (id#%d) = %.2f\n", name, id, sum);
}
public static void main(String[] args) throws FileNotFoundException {
Scanner input = new Scanner(new File("hours2.dat"));
while (input.hasNextLine()) {
String text = input.nextLine();
processLine(text);
}
}
}