Question: In this lab you will write three classes: Die, PairOfDice, and Player. The Die class mimics the rolling of a die. Specifically, this class will

 In this lab you will write three classes: Die, PairOfDice, and

In this lab you will write three classes: Die, PairOfDice, and Player. The Die class mimics the rolling of a die. Specifically, this class will implement the following methods: A default constructor initializing the number of sides of a die to 6. An overloaded constructor that takes an integer number of sides (assume greater than 1) roll which generates and returns a random number between 1 and the number of sides (inclusive) An accessor method to read the value of the face on the die. A toString method returning the string representation of the face value. The maximum number of sides should be stored as a private constant in the Die class. Also use the Random class for the random number generator The PairOfDice class mimics the rolling of two dice. Specifically, this class will implement the following methods: A default constructor that creates and initializes the number of sides of each die to 6. An overloaded constructor that creates and takes two integer number of sides, one for each die. roll rolls each die and returns the sum. An accessor method to read the sum of the dice. The Player class implements the main method which creates the dice pair and rolls them several times reporting the results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!