/* * Created on Jun 29, 2004 */ package baseball; /** Encapsulate information about a single pitcher. *
Note that no compareTo method is provided, since the one in the * superclass suffices. The "implements Comparable" is not actually * needed, since the superclass is already Comparable, but having this * on the subclass causes the compiler to check that this is true. * @author dickey */ public class Pitcher extends Player implements Comparable { public static final String pitcherPositionCode = "P"; /** Number of games won (from the data file). */ String gamesWon; /** Number of games lost (from the data file). */ String gamesLost; /** ERA (earned-run-average) (from the data file). */ String era; public Pitcher(String fullname, String teamAbbrev, String won, String lost, String era) { super(fullname, teamAbbrev, pitcherPositionCode); this.gamesWon = won; this.gamesLost = lost; this.era = era; } public String toString() { return super.toString() + " \t" + "W" + this.gamesWon + " L" + this.gamesLost + " ERA: " + this.era; } }