subject

Using the Die class provided design and implement a class called PairOfDice, composed of two Die objects. Include methods to set and get the individual die values, a method to roll the dice, and a method that returns the current sum of the two die values. Create a driver class called RollingDice2 to instantiate and use a PairOfDice object. Here is the Die class:import java. util. Random;/** The Die class simulates a six-sided die.*/public class Die{ private int sides; // Number of sides private int value; // The die's value /** The constructor performs an initial roll of the die. @param numSides The number of sides for this die. */ public Die(int numSides) { sides = numSides; roll(); } /** The roll method simlates the rolling of the die. */ public void roll() { // Create a Random object. Random rand = new Random(); // Get a random value for the die. value = rand. nextInt(sides) + 1; } /**getSides method @return The number of sides for this die. */ public int getSides() { return sides; } /**getValue method @return The value of the die. */ public int getValue() {return value; }

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:40
Gabe wants to move text from one document to another document. he should copy the text, paste the text, and open the new document highlight the text, select the cut command, move to the new document, make sure the cursor is in the correct location, and select the paste command select the save as command, navigate to the new document, and click save highlight the text, open the new document, and press ctrl and v
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
You know the right answer?
Using the Die class provided design and implement a class called PairOfDice, composed of two Die obj...
Questions
question
Arts, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Advanced Placement (AP), 30.10.2020 19:30
question
Business, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
question
Mathematics, 30.10.2020 19:30
Questions on the website: 13722362