/**
 * Sums the value of all the command line arguments and then
 * prints the total and average.
 *
 * @author Zach Tomaszewski
 */
public class Adder {

  public static void main(String[] args) {
    try {
      int total = 0;
      for (int i = 0; i < args.length; i++) {
        total += Integer.parseInt(args[i]);
      }
      System.out.println("Total: " + total);
      if (args.length > 0) {
        System.out.println("Average: " + (total / args.length));
      }
    }catch (NumberFormatException nfe) {
      System.out.println("All arguments must be integers.");
    }
  }

}
