Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specifications Create a class named Die to store the data about each die. This class should contain these constructors and methods: public Die() // set

Specifications Create a class named Die to store the data about each die. This class should contain these constructors and methods: public Die()

// set the initial value of the die to zero public void roll() public int getValue()

Create a class named Dice to store two dice. This class should contain two instance variables of the Die type and these constructors and methods: public Dice() // instantiate the Die instance variables public int getDie1Value () public int getDie2Value () public int getSum() // get the sum of both dice public void roll() // roll both dice public void printRoll() // display result of roll

You can use the random method of the Math class to generate a random number for a die like this: value = (int) (Math.random() * 6) + 1; When printing the results of the roll of the dice, display the value of each die and the total. In addition, display special messages for craps (sum of both dice is 7), snake eyes (double 1s), and box cars (double 6s).

Part 1 - Designing phase: Your task for this part is to develop: i. A UML class diagram representing the three classes of the application and their relationship. This diagram should look similar to the Line Item application class diagram on page 225 in the textbook, including all the fields and methods of each class. If you find it is more convenient to draw the UML diagram using Word or a different application other than Notepad, you might submit a separate file for this part only. If so, please indicate in your submission so that I know how many file(s) I should grade. ii. An informal description of each of the following classes: Die and Dice. An example for this class description could be the two paragraphs describing the ListItem class on page 224. iii. An informal description of how the DiceRollerOOPApp class (that contains the main method) utilizes other classes to accomplish the task. An example would be the first two paragraphs that describes the LineItemApp class on page 226.

I just want the uml class diagram

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions