Ok, to start, you'll need these variables for your PairofDie class:
private Die die1;
private Die die2;
Now, for die1 and die2, you'll notice they are declared as Die objects. This means that you'll have to create a Die class that will create a Die object, like so:
class Die
{
private final int MAX = 6;
private int facevalue;
public Die()
{
/* Constructor */
}
public void roll()
{
facevalue = (int)(Math.random() * MAX) + 1;
}
}
In the above, you'll include your methods for getting and setting the values of the Die facevalue.
Then in your your PairofDie constructor, you'd create your two dice:
public PairofDie()
{
die1 = new Die();
die2 = new Die();
}
Rolling your dice would be a matter of:
public void rolldice()
{
die1.roll();
die2.roll();
}
Then you'd include a method to return the sum of die1 and die2 in your PairofDie class.
After all that, you'll create that RollingDice class that'll have the main method which will instantiate and utilize the PairofDie class.
3 files (and classes) in all: Die.java, PairofDie.java, and RollingDice.java.
Greetings.