Help with my assignment java
I have an assignment:
Design and implement a class called PairOfDice, composed of tow die objects. Include methods to set and get the individual die values, a method to roll the dice, and a method that return the current sum of the die.
Create a driver class called RollingDice2 to instantiate and use a PairofDice object.
This is what I have so far I just wanted to see if I'm at least on the right track for this program.
Code:
public class PairofDie
{
private final int MAX = 6;
private int faceValue;
public Die1()
{
faceValue = 1;
}
public int roll()
{
faceValue = (int)(Math.random() * Max) + 1;
return faceValue;
}
public void setFaceValue (int value)
{
faceValue = value;
}
Public int getFaceValue()
{
return faceValue;
}
public String toString()
{
string result = Integer.toString (faceValue);
return result;
}
}
public Die2()
{
faceValue = 1;
}
public int roll()
{
faceValue = (int)(Math.random() * Max) + 1;
return faceValue;
}
public void setFaceValue (int value)
{
faceValue = value;
}
Public int getFaceValue()
{
return faceValue;
}
public String toString()
{
string result = Integer.toString (faceValue);
return result;
}
}
Thanks