Alright, My issue is that the 2nd if and 3rd if statement is throwing up an Operator '<' '>' is undefined.
It should be two int values and show be able to do lesser or greater, not sure why it's not working on my end. Here are the two codes:
public class TwoDice2 {
public static void main(String[ ] args) {
Die firstDie = new Die( );
Die secondDie = new Die( );
if (firstDie == secondDie) {
System.out.println("First die is " + firstDie.getValue( ));
System.out.println("Next die is " + secondDie.getValue( ));
System.out.println("The two dice are the same!");
}
if (firstDie > secondDie) {
System.out.println("First die is " + firstDie.getValue( ));
System.out.println("Next die is " + secondDie.getValue( ));
System.out.println("Die One: " + firstDie + " is greater than Die Two: " + secondDie);
}
if (firstDie < secondDie) {
System.out.println("First die is " + firstDie.getValue( ));
System.out.println("Next die is " + secondDie.getValue( ));
System.out.println("Die One: " + firstDie + " is less than Die Two: " + secondDie);
}
}
}
And:
public class Die {
private int value;
private static final int HIGHEST_DIE_VALUE = 6;
private static final int LOWEST_DIE_VALUE = 1;
public Die() {
value = ((int)(Math.random() * 100) % HIGHEST_DIE_VALUE + LOWEST_DIE_VALUE);
} public int getValue() { return value; } }