Question: Problem 1 . ( Die Data Type ) Implement a comparable data type called Die that represents a six - sided die and supports the
Problem Die Data Type Implement a comparable data type called Die that represents a sixsided die and supports the following API:
Die
Die constructs a die with the face value
void roll rolls this die
int value returns the face value of this die
boolean equalsDie other returns true if this die is the same as other, and false otherwise
String toString returns a string representation of this die
int compareToDie other returns a comparison of this die and other based on their face values
& ~workspaceautocomplete
$ javac d out $ java Die Dice a b and
aequalsb
aequalsc acompareTob acompareToc
srcDiejava c:
false true
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
