Question
Need help with the following program with Java: public class Dice { //Variable to name side of dice and value private String DiceValue; private String
Need help with the following program with Java:
public class Dice {
//Variable to name side of dice and value
private String DiceValue;
private String DiceSide;
//default constructor:
public Dice() {
DiceValue="1";
DiceSide="side 1";
}//end constructor
//non default constructor
public Dice(String value, String side) {
DiceValue=value;
DiceSide=side;
}//end non default contructor
//getter method, accessor method
public String getDiceValue() {
return DiceValue;
}
public String getDiceSide() {
return DiceSide;
}//end get method
//Setter Method
public void setDiceValue(String newDiceValue) {
DiceValue=newDiceValue;
}
public void setDiceSide(String newDiceSide) {
DiceSide=newDiceSide;
}
public String toString() {
return DiceValue + " " + DiceSide;
}
}//end class
With the following code I need to write a Dice game between 2 players that will return the higher value of dice. It needs to use Setters and Getters please. I just dont know where to continue after seeing this code written.
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