Question: Tasks 1 . Create a package named edu.ics 1 1 1 . h 0 7 in your ICS 1 1 1 - workspace project This
Tasks
Create a package named edu.icsh in your ICSworkspace project
This is where we will put all our classes for homework
Write a program that allows players to play the game TwoDice Pig. The name of the class that plays the game isTwoDicePigGame
The rules of TwoDice Pig are:
Each turn, a player repeatedly rolls two dice until a is rolled or the player decides to hold:
If two s are rolled, the players entire score is lost, and the turn ends.
If a single is rolled, the player scores nothing and the turn ends.
If the player rolls any other number, it is added to their turn total and the players turn continues.
If a double is rolled, the point total is added to the turn total as with any roll but the player is obligated to roll again.
If a player chooses to hold their turn total is added to their score, and it becomes the next players turn.
The first player to or more points wins.
The program should ask for the number of players, then create an array ofPlayers ThePlayerclass should have a name instance variable and a score instance variable. Once the players are initialized the program should start playing the game by giving each player a turn.
The program should have a function namedplayerTurnthat allows the player to decide when to hold The function must return the score for the players turn.
The program should use an instance of the classPairOfDiceto do the rolling of the dice. See the text for examples of the class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
