/* * Contestant.java * * Created on June 19, 2003, 6:52 PM * Modified June 27, 2003, 1:12 PM */ /** * Keep track of a contestant's match records * * @author Martin Dickey * @version 1.1 */ public class Contestant { final private String name; // Name of this contestant, with spaces trimmed private int gamesWon = 0; // Number of games won private int gamesLost = 0; // Number of games lost private int gamesDrawn = 0; // Number of games drawn /** * Creates a new instance of Contestant * * @param teamName the name of the team trimmed */ public Contestant(String teamName) { this.name = teamName.trim(); } /** * Retrieve the number of games lost by this Contestant * * @return number of games lost */ public int getGamesLost() { return this.gamesLost; } /** * Retrieve the number of games won by this Contestant * * @return number of games won */ public int getGamesWon() { return this.gamesWon; } /** * Retrieve the number of games resulting in a tie by this Contestant * * @return number of games drawn */ public int getGamesDrawn() { return this.gamesDrawn; } /** * Retrieve the name of this Contesant * * @return name of the contestant */ public String getName() { return this.name; } /** * Update the Contestant's stats to show that a game was lost */ public void recordLoss() { this.gamesLost++; } /** * Update Contestant's stats to show that a game was won */ public void recordWin() { this.gamesWon++; } /** * Update Contestant's stats to show that a game was drawn */ public void recordDraw() { this.gamesDrawn++; } }