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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!