import java.util.Arrays; /* SixSidedDieWithCounts.java ** An instance of this class, which is a child of SixSidedDie, represents a ** six-sided die, such as is used in board games (e.g., Monopoly) and other ** games of chance (e.g., craps). The capability added here is that of ** reporting how many times the die has been rolled and, for each possible ** result (1 through 6), how many times it has occurred. ** ** Author: R. McCloskey and < STUDENTS' NAMES > ** Known Flaws: ... */ public class SixSidedDieWithCounts extends SixSidedDie { // instance variable // ----------------- // RWM: Probably at least one is necessary // constructors // ------------ public SixSidedDieWithCounts(int seed) { // Call the parent class's constructor super(seed); // RWM: Missing code to initialize any new instance variables } public SixSidedDieWithCounts() { // Call the parent class's constructor super(); // RWM: Missing code to initialize any new instance variables } // observers // --------- /* Returns how many rolls of this die have resulted in k pips showing. ** pre: 1 <= k <= 6 */ public int numTimesRolled(int k) { return -1; // STUB } /* Returns the (total) number of times this die has been rolled. */ public int numTimesRolled() { return -1; // STUB } /* Returns a string indicating the # pips showing on this die ** and how many times it has been rolled. */ @Override public String toString() { return super.toString() + "; # times rolled: " + numTimesRolled(); } // mutator // ------- /* Rolls this die. */ @Override public void roll() { // STUB } }