/* * @topic T00615 Baseball demo application * @brief abstract class BaseballPlayer */ package baseball; public abstract class BaseballPlayer { // Common data attributes: private int playerNumber; private String playerName; private int numberAtBats; private int numberHits; // Constructor method public BaseballPlayer( int playerNumber, String playerName, int numberAtBats, int numberHits ) { this.playerNumber = playerNumber; this.playerName = playerName; this.numberAtBats = numberAtBats; this.numberHits = numberHits; } // Getter example public int getPlayerNumber() { return playerNumber; }//getPlayerNumber // Setter example public void setPlayerNumber(int pn) { playerNumber = pn; }//setPlayerNumber // the method that computes percentage of the Batting Average public int computeBattingAverage() { int result = 100 * numberHits / numberAtBats; return result; }//computeBattingAverage public abstract int rankPlayer(); }//class BaseballPlayer