So first I'm supposed to create a Die class for generating a random number from 1 to 6
import java.util.*;
public class Die
{
int faceValue;
final int HIGHEST_DIE_VALUE = 6;
final int LOWEST_DIE_VALUE = 1;
public int getRoll()
{
return faceValue;
}
public void setRoll(int rolled)
{
faceValue = ((int)(Math.random() * 100) % HIGHEST_DIE_VALUE + LOWEST_DIE_VALUE);
}
}
Then my next class prints out the value of rolling two dice.
public class TwoDice
{
public static void main(String[] args)
{
Die dieRoll = new Die();
System.out.println("The first die roll is " + dieRoll.getRoll());
System.out.println("The seoncd die roll is " + dieRoll.getRoll());
}
}
The number that keeps printing no matter how many runs is always 0.