Question
It is in JAVA I need help finishing DiceSet.java ... I don't know what to do. Please! /** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * File name : DiceSet.java *
It is in JAVA
I need help finishing DiceSet.java... I don't know what to do. Please!
/** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* File name : DiceSet.java
* Purpose : Provides a class describing a set of dice
* Author :
* Date :
* Description : This class provides everything needed (pretty much) to describe a set of dice. The
* idea here is to have an implementing class that uses the Die.java class. Includes
* the following:
* public DiceSet( int k, int n ); // Constructor for a set of k dice each with n-sides
* public int sum(); // Returns the present sum of this set of dice
* public void roll(); // Randomly rolls all of the dice in this set
* public void rollIndividual( int i ); // Randomly rolls only the ith die in this set
* public int getIndividual( int i ); // Gets the value of the ith die in this set
* public String toString(); // Returns a stringy representation of this set of dice
* public static String toString( DiceSet ds ); // Classwide version of the preceding instance method
* public boolean isIdentical( DiceSet ds ); // Returns true iff this set is identical to the set ds
* public static void main( String[] args ); // The built-in test program for this class
*
* Notes : Stolen from Dr. Dorin pretty much verbatim, then modified to show some interesting
* things about Java, and to add this header block and some JavaDoc comments.
* Warnings : None
* Exceptions : IllegalArgumentException when the number of sides or pips is out of range
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Revision Histor
* ---------------
* Rev Date Modified by: Reason for change/modification
* ----- ---------- ------------ -----------------------------------------------------------
* @version 1.0.0 2017-02-09 B.J. Johnson Initial writing and release
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
public class DiceSetEmpty {
/**
* private instance data
*/
private int count;
private int sides;
private Die[] ds = null;
// public constructor:
/**
* constructor
* @param count int value containing total dice count
* @param sides int value containing the number of pips on each die
* @throws IllegalArgumentException if one or both arguments don't make sense
* @note parameters are checked for validity; invalid values throw "IllegalArgumentException"
*/
public DiceSetEmpty( int count, int sides ) {
ds = new Die[ count ];
}
/**
* @return the sum of all the dice values in the set
*/
public int sum() {
return 0;
}
/**
* Randomly rolls all of the dice in this set
* NOTE: you will need to use one of the "toString()" methods to obtain
* the values of the dice in the set
*/
public void roll() {
}
/**
* Randomly rolls a single die of the dice in this set indexed by 'dieIndex'
* @param dieIndex int of which die to roll
* @return the integer value of the newly rolled die
* @trhows IllegalArgumentException if the index is out of range
*/
public int rollIndividual( int dieIndex ) {
return 0;
}
/**
* Gets the value of the die in this set indexed by 'dieIndex'
* @param dieIndex int of which die to roll
* @trhows IllegalArgumentException if the index is out of range
*/
public int getIndividual( int dieIndex ) {
return -999;
}
/**
* @return Public Instance method that returns a String representation of the DiceSet instance
*/
public String toString() {
String result = "";
return result;
}
/**
* @return Class-wide version of the preceding instance method
*/
public static String toString( DiceSet ds ) {
return "";
}
/**
* @return tru iff this set is identical to the set passed as an argument
*/
public boolean isIdentical( DiceSet ds ) {
return true;
}
/**
* A little test main to check things out
*/
public static void main( String[] args ) {
// You do this part!
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started