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 15:10
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
Which option allows you to view slides on the full computer screen?
Answers: 1
question
Computers and Technology, 23.06.2019 16:10
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
You know the right answer?
Using the Die class provided design and implement a class called PairOfDice, composed of two Die obj...
Questions
question
Mathematics, 30.01.2020 05:59
question
Mathematics, 30.01.2020 05:59
Questions on the website: 13722361