import SimpleOutput;

/**
 * Compute the average of a list of numbers entered on the command
 * line.  For example, to compute the average of a, b, and c, you
 * would write
 *   % java Average a b c
 *
 * @author Carla Caffeinated
 * @author Carl Caffeinated
 * @author Samuel A. Rebelsky
 * @author YOUR NAME HERE
 * @version 1.0 of September 1999
 */
public class Average {
  public static void main(String[] args) {
    int sum = 0;	// The sum of all the values entered.
    int count = 0;	// The number of values entered.
    SimpleOutput out = new SimpleOutput();
    
    // Step through the values, adding each in turn.  Skip those
    // that aren't valid.
    for (int i = 0; i < args.length; i = i+1) {
      try {
        sum = sum + Integer.parseInt(args[i]);
        count = count + 1;
      }
      catch (NumberFormatException nfe) {
        // Skip it.
        i = i + 1;
      }
    } // for
  
    // Print the average.
    out.println("The average grade is: " + (sum/count));
  } // main(String[])
} // class Average


