Question: 2. Multisided Dice The Die class in the text assumes dice have 6 sides. You may have seen dice with 4, 10, 12, 20 sides

 2. Multisided Dice The Die class in the text assumes dice

2. Multisided Dice The Die class in the text assumes dice have 6 sides. You may have seen dice with 4, 10, 12, 20 sides in various games. With computers we are not limited by geometric considerations and can easily create dice with any number of sides. 1. Copy the Die class from the lecture into package ca.bcit.comp1510.lab04. Change the name of the Die.java file and the class name to MultiDie (you can right-click on the Die file and use refactor>rename from the popup menu) and make whatever changes may be required for MultiDie to compile. 2. Modify the JavaDoc to reflect your modifications. You are an author, but the old authors are still needed unless you totally rewrite the code. 3. Remove the initialization from the MAX constant declaration, remove the modifier static, but keep it final. Change the name to max. The value will be set in a constructor. 4. Modify the MultiDie constructor by adding a parameter int numSides, and changing the body to initialize max to numSides and calling the roll method to initialize faceValue. 5. Modify the roll() method to use max instead of MAX. 6. Write a driver class RollingMultiDice to exercise MultiDie. If useful, you can start from the lecture's RollingDice class. 7. Answer the following questions as comments in your MultiDie class (in the class JavaDoc comments) 1. Do you need getters and setters for max? Should you have them? 2. Can you have getters and setters for max? 3. Why do you think it makes sense (or not) to have max be final? 4. What does max's being final say about the abstraction of a MultiDie object? 5. Is max an instance variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!