/* * Created on Jun 29, 2004 */ package baseball; /** Represent a hitter (non-pitcher player on a baseball team).
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 Hitter extends Player implements Comparable { /** Batting average (data from the file). */ private String battingAvg; /** Construct a Hitter object. * * @param fullname Player's name (from the file) * @param teamAbbrev Team abbreviation (from the file) * @param battingAverage value of the batting average */ public Hitter(String fullname, String teamAbbrev, String position, String battingAverage) { super(fullname, teamAbbrev, position); this.battingAvg = battingAverage; } /** Format a simple string representation; depends on the superclass * toString for basic information. */ public String toString() { return super.toString() + " \tbatting average: " + this.battingAvg; } }