Question
SuperDie in JAVA Write a class SuperDie that models a single die with an arbitrary number of sides between 4 and 12. Instance variables should
SuperDie in JAVA Write a class SuperDie that models a single die with an arbitrary number of sides between 4 and 12. Instance variables should include: IDOFDIE a String An where n starts from 0 and is incremented for each new die so that the ID for the first die is A1. A final variable after it is set. NUMSIDES The number of sides as an int in the die, defined as a part of construction as a number between 4 and 12. A final variable after it is set. counterForID a static int that is used to help create the DOFDIE sumRolls a static variable that keeps track of the sum of the rolls of all the SuperDie randy a reference variable to a random number generator established for each SuperDie The construct has no parameter but creates the IDOFDIE and NUMSIDES for these The methods of this class should be: rollDie - roll a die and return its value, and add this value to the static value keeping track of the sumRolls that keeps track of the sum of the rolls. getSides -An accessor that returns the number of sides on a die getIDOfDie An accessor which return the IDOFDIE getSumRolls An accessor which returns sumRolls Create a SuperDieClient which has a main(...) method that does the following: Create an ArrayList dieList of type SuperDie. Create twenty SuperDie and add them to dieList. For each SuperDie in dieList Roll the die once. Print out the ID and the number of sides of the SuperDie, and the results of the latest roll of that SuperDie Sample Output: Die ID Sides Roll
A1 11 4
A2 11 6
A3 12 5
A4 8 5
A5 7 6
A6 6 2
A7 11 7
A8 11 11
A9 4 4
A10 10 8
A11 8 3
A12 9 5
A13 9 7
A14 11 7
A15 12 9
A16 9 4
A17 4 2
A18 12 7
A19 9 1
A20 4 3 The sum of the rolls is 106
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started