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 11:00
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 2
question
Computers and Technology, 24.06.2019 18:30
Is a type of bullying that takes place when a person intentionally posts negative information about another that is not true
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
History, 20.10.2019 03:50
question
Social Studies, 20.10.2019 03:50
question
Physics, 20.10.2019 03:50
question
Mathematics, 20.10.2019 03:50
question
Mathematics, 20.10.2019 03:50
question
Mathematics, 20.10.2019 03:50
question
Mathematics, 20.10.2019 03:50
question
Business, 20.10.2019 03:50
Questions on the website: 13722360