Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class called SuperDice that defines a collection of SuperDie objects. (S

ID: 3669907 • Letter: W

Question

Write a class called SuperDice that defines a collection of SuperDie objects. (See Exercise 2.) The instance variables include a field that holds the number of dice in the collection as well as an array that holds SuperDie objects.The SuperDice class should have methods that change the number of sides on any particular die return the number of sides on the any die roll all the dice and return the sum of the dice return the number of dice in the collection The default constructor creates a single die with six sides. A one-argument constructor accepts an array of n values giving the number of sides on each of n dice. A two-argument constructor with two integer parameters p and q defines p dice each with q sides. Test your class by writing a main method that: randomly rolls a collection of five dice (one 6-sided, one 20-sided, one 4-sided,one 8-sided, and one 12-sided) 100 times, and reports the average of the sum of the five dice, randomly rolls a single 6-sided die 100 times, and reports the average, randomly rolls three 6-sided dice 100 times, and reports the average, and randomly rolls three 20-sided dice 100 times, and reports the average.

Explanation / Answer

Hi, can you please post your SuperDice class as you have mentioned this is given in Exercise 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote