Java do all  four classes and for pig dice there are two more specifications for it Method pigged out returns true and false whether the last roll contained a 1 and ended the roll. Additional private methods used for modulazarion. Method single one rolled returns true/false whether one of the two die resulted in a 1 Method double one rolled returns true/false whether both die rolled a 1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Java do all  four classes and for pig dice there are two more specifications for it

  • Method pigged out returns true and false whether the last roll contained a 1 and ended the roll.
  • Additional private methods used for modulazarion.
  1. Method single one rolled returns true/false whether one of the two die resulted in a 1
  2. Method double one rolled returns true/false whether both die rolled a 1
**Game Design Project Documentation**

---

**Game Requirements:**

- Players should be able to play multiple games.
- Users must enter a valid maximum score.
- Display the winner and winning score once the goal score is reached.
- Show total scores after each round.

**Components:**

- **Class PigDice:**
  - Manages dice state for a player.
  - Ensures correct scoring for all dice combinations.

- **Class Die:**
  - Represents a standard 6-sided die.
  - Simulates rolling.
  - Displays face value without rolling.

---

**Specifications:**

**Die Class:**

- Handles random number generation and rolled face value.
- Includes an overloaded constructor for testing with specific seeds (5 and 10).

**EntryPoint Class:**

- Contains the `main` method.
- Sets up a `GameController` object and starts the `play` method.

**GameController Class:**

- Central logic in `play` method.
- Requires modular private methods.
  - Example: `takeTurn` handles player actions.
  - Another method fetches the valid goal score.

**PigDice Class:**

1. Maintains Player Pig score for the round.
2. Manages the total Pig score.
3. Features related to rolling and scoring dice.

**Methods:**

- `currentTotal`: Returns total score.
- `currentRound`: Returns round score (use input/output Session 5 to differentiate).
- `rollDice`: Simulates rolling two dice.
- `evaluate`: Adds rolled score to the current total.
- `lastRoll`: Provides a formatted string of the last roll details.
- `save`: Adds round score to total, clears current score, and returns the round score. 

---

This documentation outlines the implementation details and design considerations for a dice-based game project, focusing on modularity, score management, and user interaction.
Transcribed Image Text:**Game Design Project Documentation** --- **Game Requirements:** - Players should be able to play multiple games. - Users must enter a valid maximum score. - Display the winner and winning score once the goal score is reached. - Show total scores after each round. **Components:** - **Class PigDice:** - Manages dice state for a player. - Ensures correct scoring for all dice combinations. - **Class Die:** - Represents a standard 6-sided die. - Simulates rolling. - Displays face value without rolling. --- **Specifications:** **Die Class:** - Handles random number generation and rolled face value. - Includes an overloaded constructor for testing with specific seeds (5 and 10). **EntryPoint Class:** - Contains the `main` method. - Sets up a `GameController` object and starts the `play` method. **GameController Class:** - Central logic in `play` method. - Requires modular private methods. - Example: `takeTurn` handles player actions. - Another method fetches the valid goal score. **PigDice Class:** 1. Maintains Player Pig score for the round. 2. Manages the total Pig score. 3. Features related to rolling and scoring dice. **Methods:** - `currentTotal`: Returns total score. - `currentRound`: Returns round score (use input/output Session 5 to differentiate). - `rollDice`: Simulates rolling two dice. - `evaluate`: Adds rolled score to the current total. - `lastRoll`: Provides a formatted string of the last roll details. - `save`: Adds round score to total, clears current score, and returns the round score. --- This documentation outlines the implementation details and design considerations for a dice-based game project, focusing on modularity, score management, and user interaction.
**Overview**

Write a program that will simulate the dice game *Pig* for 2 players.

**Background: Game Rules**

The rules to the (dice) game of *Pig*:

- You will need 2 dice.
- To Play:
  - a. The players each take turns rolling two dice.
  - b. A player scores the sum of the two dice thrown (unless the roll contains a 1): If a single number 1 is thrown on either die, the score for that whole turn is lost (referred to as “Pigged Out”). A 1 on both dice is scored as 25.
  - c. During a single turn, a player may roll the dice as many times as they desire. The score for a single turn is the sum of the individual scores for each dice roll.
  - d. The first player to reach the goal score wins unless a player scores higher subsequently in the same round. Therefore, everyone in the game must have the same number of turns.

**Execution and User Input**

This program is quite interactive with the user(s) and will take in the following information; please review the sample input/output sessions for details; we describe them again here emphasizing input.

The program will prompt for the number of points the game will be played to (1-100).

Once a valid goal score has been entered the game will “roll” the dice for the first player by randomly selecting the valid values 1 thru 6 for each of the two dice. The score will be displayed and the player will be prompted to continue their turn by rolling the dice again (unless they have “pigged out” by rolling a single 1).

The player will have the option of continuing or ending the turn by entering ‘y’ for Yes.

When Player 1 completes their turn, Player 2 will engage the exact same way.

At the conclusion of both player’s turns the total score for each will be compared to the goal score to determine if the game has ended. If the goal score has *not* been reached, then the game continues with both players taking their turn in sequence. Once one or both of the players reaches the goal score the game ends and the results are displayed. The game may end in a tie.

At the conclusion of a game, the program will prompt whether a new game shall be played: ‘y’ for Yes.

**Requirements**

- The name of the Java Project must be `Project
Transcribed Image Text:**Overview** Write a program that will simulate the dice game *Pig* for 2 players. **Background: Game Rules** The rules to the (dice) game of *Pig*: - You will need 2 dice. - To Play: - a. The players each take turns rolling two dice. - b. A player scores the sum of the two dice thrown (unless the roll contains a 1): If a single number 1 is thrown on either die, the score for that whole turn is lost (referred to as “Pigged Out”). A 1 on both dice is scored as 25. - c. During a single turn, a player may roll the dice as many times as they desire. The score for a single turn is the sum of the individual scores for each dice roll. - d. The first player to reach the goal score wins unless a player scores higher subsequently in the same round. Therefore, everyone in the game must have the same number of turns. **Execution and User Input** This program is quite interactive with the user(s) and will take in the following information; please review the sample input/output sessions for details; we describe them again here emphasizing input. The program will prompt for the number of points the game will be played to (1-100). Once a valid goal score has been entered the game will “roll” the dice for the first player by randomly selecting the valid values 1 thru 6 for each of the two dice. The score will be displayed and the player will be prompted to continue their turn by rolling the dice again (unless they have “pigged out” by rolling a single 1). The player will have the option of continuing or ending the turn by entering ‘y’ for Yes. When Player 1 completes their turn, Player 2 will engage the exact same way. At the conclusion of both player’s turns the total score for each will be compared to the goal score to determine if the game has ended. If the goal score has *not* been reached, then the game continues with both players taking their turn in sequence. Once one or both of the players reaches the goal score the game ends and the results are displayed. The game may end in a tie. At the conclusion of a game, the program will prompt whether a new game shall be played: ‘y’ for Yes. **Requirements** - The name of the Java Project must be `Project
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY