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
1. Create a package named edu.ics111.h07 in your ICS111-workspace project
This is where we will put all our classes for homework 07.
1) Write a program that allows players to play the game Two-Dice Pig. The name of the class that plays the game isTwoDicePigGame.
The rules of Two-Dice Pig are:
Each turn, a player repeatedly rolls two dice until a 1 is rolled or the player decides to hold:
If two 1s are rolled, the players entire score is lost, and the turn ends.
If a single 1 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 100 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 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 Programming Questions!