CMPS 144L
Lab Activity: Complete the SixSidedDieWithCounts Class

Image of a pair of dice
You are given the SixSidedDie class. As its name suggests, an instance of this class represents a single six-sided die, such as is used in board games and other games of chance. Its functionality is quite limited, as all a client can do with a SixSidedDie object is to roll it and to ascertain the result of the most recent roll, which is the number of pips on the upward facing side of the die.

Your task is to complete the development of a child class, SixSidedDieWithCounts, each instance of which has the additional capabilities of reporting how many times it has been rolled (in total) and, for each of the six possible results of a roll, how many times that result has occurred.

For objects of the child class to have these extra capabilities, it is necessary for them to store more data (about their own histories) than objects of the parent class. It follows that the child class needs to include declarations of one or more "new" instance variables having as its/their purpose to store information about results of past rolls. Of course, the values of that/those variable(s) must be updated when/where appropriate.

You should submit the completed source code (the file SixSidedDieWithCounts.java) to the relevant folder.

To aid you in testing your work, the Java application DieTester is provided. Below is a sample dialog between it and the user. The program creates two die objects, one being an instance of SixSidedDie (referred to as the "Regular" die) and the other an instance of its child class, SixSidedDieWithCounts, referred to as the "Counting" die. The program prompts the user to enter two integer inputs. One is a seed for the pseudo-random number generator that is used in producing the results of die rolls. The other is the number of times to roll each die. After each roll, the result is reported.

At the conclusion of all the rolls, the distribution of roll results is reported (making use of the "Counting" die's ability to keep track of this information).

Welcome to the Die Tester.

Enter seed: 36
Enter # times to roll each die: 10

After the 1-th roll:
Regular die:  pips showing: 2
Counting die: pips showing: 2; # times rolled: 1

After the 2-th roll:
Regular die:  pips showing: 2
Counting die: pips showing: 2; # times rolled: 2

After the 3-th roll:
Regular die:  pips showing: 6
Counting die: pips showing: 6; # times rolled: 3

After the 4-th roll:
Regular die:  pips showing: 1
Counting die: pips showing: 1; # times rolled: 4

After the 5-th roll:
Regular die:  pips showing: 4
Counting die: pips showing: 4; # times rolled: 5

After the 6-th roll:
Regular die:  pips showing: 2
Counting die: pips showing: 2; # times rolled: 6

After the 7-th roll:
Regular die:  pips showing: 6
Counting die: pips showing: 6; # times rolled: 7

After the 8-th roll:
Regular die:  pips showing: 3
Counting die: pips showing: 3; # times rolled: 8

After the 9-th roll:
Regular die:  pips showing: 6
Counting die: pips showing: 6; # times rolled: 9

After the 10-th roll:
Regular die:  pips showing: 3
Counting die: pips showing: 3; # times rolled: 10

1 was rolled 1 times.
2 was rolled 3 times.
3 was rolled 2 times.
4 was rolled 1 times.
5 was rolled 0 times.
6 was rolled 3 times.