Using the Die class defined in Chapter 4, write a class called PairOfDice, composed of two Die objects. Include a constructor, methods to set and get each of the individual die values, a method to roll the two die, and a method that returns the current sum of the two die values.
What I have tried:
public class PairOfDice {
Die die1 = new Die();
Die die2 = new Die();
public int getDie1Value() {
return die1Value;
}
public int getDie2Value() {
return die2Value;
}
public void setDie1Value(int die1) {
die1Value = value;
}
public void setDie2Value(int die2) {
die2Value = value;
}
public PairOfDice() {
roll();
}
public int total() {
return die1+die2;
}
}