Question: Okay I need help with this code the white is the assignment. One is the class die and the other is Testdie. I wanna know
1. Implement the Die class based on the UML below. It represents one die (singular of dice) with faces having values 1 to a maximum value (usually 6). Die private int faceValue private int maxValuethe maximum face value allowed // current value showing on the die (1 to maxValue) public Die) public void setFaceValue(int value)//faceValue set to value if between 1 and maxValue public int getfaceValuel) public void roll() // constructor. face Value set to 1, maxValue set to I/otherwise no change to face Value //returns the object's current faceValue I/ randomly generates a number between 1 and maxValue. // sets the facevalue to this number public String toStringl //returns the current state of a die object (instance varlable values) 2. Test with TestDie.java. Begin with the followin public class TestDie public static void main Stringl ] args) //create a Die object called die1 //display the state of object die1 //set the faceValue of die1 to 4 //display the state of object die1 //set the faceValue of die1 to 15 //display the state of object die1 /froll die1 lldisplay the faceValue of die The output from TestDie-java Beginning state of die1 : faceValue : 1 maxValue:6 State of die1 after setting faceValue to 4: faceValue: 4 maxValue: 6 State of die1 after attempting to set faceValue to 15: faceValue : 4 maxValue:6(not able to change faceValue to 15 so remains 4) The faceValue of diel after a roll: 5 the foceValue should be any number between 1 -6) 3. Submit Die-java and TestDie java (with output included). Challenge (if you have time): Download DiceGame.java. It also uses the Die class. Examine the code and add the features indicated. Your output should resemble the output given in DiceGame.java. 4. 5. Submit Die.java, TestDie.java, and DiceGame.java. Opbaker
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
