/*
 * Athlete: This class stores information for one athlete, who
 *          competes in one category in the triathalon.
 */

class Athlete {

	private String athleteName;		// name of the athlete (unique)
	private int athleteNumber;		// assigned athlete number
	private int[] times;			// stores times for each event

	private final int NUM_EVENTS = 3;	// number of events

	// Elements in the array that still have a zero value, indicate
	// that this event time has not yet been entered.
	public final static int NOT_ENTERED = 0;

	/*
	 * Athlete constructor: Create a new athlete, that is named
	 * 'name' and has athlete number 'athleteNumber'.
	 */
	public Athlete (String name, int athleteNumber) {
		this.athleteName = name;
		this.athleteNumber = athleteNumber;
		this.times = new int[NUM_EVENTS];
	}

	/*
	 * getName: return the athlete's name.
	 */
	public String getName () {
		return athleteName;
	}

	/*
	 * getNumber: return the athlete's athlete number.
	 */
	public int getNumber () {
		return athleteNumber;
	}

	/*
	 * addEventTime: record 'nextTime', which is the time for this
	 *    athlete's next event that does not yet have a time recorded.
	 *    This method returns false if all events have already been
	 *    recorded for this athlete.  It returns true otherwise.
	 *
	 *    Note: If the user enters four event times for an athlete, an
	 *    error would be reported, since there are only three events.
	 *    If less than three event times are recorded, we assume the
	 *    athlete did not finish the remaining events.
	 */
	public boolean addEventTime (int nextTime) {
		// FILL IN THE BODY.

		return true;
	}

	/*
	 * hasStarted: return 'true' if this athlete has at least
	 *    one event time recorded, indicating that this athlete
	 *    has started the race.
	 */
	public boolean hasStarted () {
		for (int i=0; i<times.length; i++) {
			if (times[i] != NOT_ENTERED) {
				return true;
			}
		}
		return false;
	}

	/*
	 * report: return a single line of information for one athlete
	 *    in the triathalon.  This information should include the
	 *    athlete's name, athlete number, swim time, bike time, run
	 *    time, and overall total time.  If any of the times were
	 *    not entered for this athlete report "NA" instead of an
	 *    actual time.  Use a tab ("\t") to separate each field.
	 */
	public String report () {
		// FILL IN THE BODY.
		String result = "";

		return result;
	}

	/*
	 * toString: return all information stored in this class.
	 *    This method is used for testing only.
	 */
	public String toString () {
		// THIS METHOD IS OPTIONAL - COMPLETE IF DESIRED.
		return "";
	}
}
