Question: NEEDS TO HAVE BOTH PLAYER CLASS AND DICE CLASS IN THE PROGRAM USING JAVA. Thank you Dice Class public class Dice { private int value;

NEEDS TO HAVE BOTH PLAYER CLASS AND DICE CLASS IN THE PROGRAM USING JAVA. Thank you NEEDS TO HAVE BOTH PLAYER CLASS AND DICE CLASS IN THEDice Class public class Dice { private int value; private int numSides; public Dice() { numSides = 6; value = 1; } public Dice(int numSides) { this.numSides = numSides; value = 1; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public int getNumSides() { return numSides; } public void setNumSides(int numSides) { this.numSides = numSides; } @Override public String toString() { return "Dice [value=" + value + ", numSides=" + numSides + "]"; } public int roll() { value = (int)(Math.random() * numSides) + 1; return value; } } Player Class import java.util.Arrays; public class Player { private String name; private int numOfDiceUsed; private int[] arrayOfDice; private int score; public Player(String name, int[] arrayOfDice) { this.name = name; this.arrayOfDice = arrayOfDice; numOfDiceUsed = arrayOfDice.length; } public Player(String name, int numOfDiceUsed) { this.name = name; this.arrayOfDice = new int[numOfDiceUsed]; for(int i = 0; i BEAT THAT! Beat That is a fun game that can be played by children aged 5 upwards. The number of dice used within the game can vary depending on the age of the children. For example, younger children may be fine with two dice, whereas older children may prefer more of a challenge, so potentially up to 7 dice could be used within the game. All that is needed to play Beat That is dice and a paper and pencil for scoring. Children are passed the dice and have to come up with the largest number possible combining the dice thrown. For example, if a child was using two dice and came up with a 6 and a 7, the highest number that could be achieved is 76. Similarly, if a child was using three dice and the numbers rolled were 4,6 and 8, then the highest number possible would be 864. Once players have come up with the highest number they think is possible, the dice are then passed to the next player with the invitation of 'Beat That! Children play in rounds, with a winner being declared at the end of each round. If attempting to score the highest number becomes a little repetitive, then why not consider changing the rules round, like attempting to reach the smallest number possible. After writing the algorithm you are them to implement the algorithm in code. You must use the Dice and Player objects when implementing this algorithm. You can use the Dice and Player classes that were written in class, or use your own Dice and Player classes. You can ask the user how many players there will be playing the game. The last player should be the computer. You should keep points for each player and ask if they would like to play again after the round is over. Output the total points after each round. You are to turn in your algorithm and code for this assignment. BEAT THAT! Beat That is a fun game that can be played by children aged 5 upwards. The number of dice used within the game can vary depending on the age of the children. For example, younger children may be fine with two dice, whereas older children may prefer more of a challenge, so potentially up to 7 dice could be used within the game. All that is needed to play Beat That is dice and a paper and pencil for scoring. Children are passed the dice and have to come up with the largest number possible combining the dice thrown. For example, if a child was using two dice and came up with a 6 and a 7, the highest number that could be achieved is 76. Similarly, if a child was using three dice and the numbers rolled were 4,6 and 8, then the highest number possible would be 864. Once players have come up with the highest number they think is possible, the dice are then passed to the next player with the invitation of 'Beat That! Children play in rounds, with a winner being declared at the end of each round. If attempting to score the highest number becomes a little repetitive, then why not consider changing the rules round, like attempting to reach the smallest number possible. After writing the algorithm you are them to implement the algorithm in code. You must use the Dice and Player objects when implementing this algorithm. You can use the Dice and Player classes that were written in class, or use your own Dice and Player classes. You can ask the user how many players there will be playing the game. The last player should be the computer. You should keep points for each player and ask if they would like to play again after the round is over. Output the total points after each round. You are to turn in your algorithm and code for this assignment

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!