Question: Using the Die object given, create a DieObjectTester that takes in user inputed values for how many dice, number of sides on each die and
Using the Die object given, create a DieObjectTester that takes in user inputed values for how many dice, number of sides on each die and the number of die rolls with an output as shown in the photo.
...
Number of rolls? => (user entered value)

Result: (e.g. 10 5 9 11 12 etc)
import java.util.*; public class Die { //Object attributes private String name; private int numSides; private int currentValue; private Random generator = new Random(); //Constructor with no parameters public Die() { this.numSides = 0; this.currentValue = 0; } //Constructor with one parameter public Die (int numSides_) { numSides = numSides_; currentValue = 0; } // getNumSides public int getMumSides() { return numSides; } //getCurrentValue public void getCurrentValue (int currentValue_) { this.currentValue = currentValue_; } //roll public int roll() { this.currentValue = generator.nextInt(numSides) + 1; return currentValue; } //toString public String toString() { String result=""; result += Integer.toString(currentValue); return result; } }
How many dice for each roll > 2 Number of sides for die #1 #> 6 Number of sides for die #2 => 6 Number of rolls? >100 Result: 95810 637118 10 11 10 9 58 10 77888 71069 95464 6 3 10 6 7687 87 10 68811 7 9 10 109 12 855 87588 7 10 95 4 64 12 67484 10 7 4 9 2 12 10 12 3 7 9 10 8 48711 10 9 10 8 8 10 10 6 6 5 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
