Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overvievw Write a program that will simulate the dice game Pig for 2 players. Background: Game Rules The rules to the (dice) game of Pig:

image text in transcribedimage text in transcribed

Overvievw 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 The players each take turns rolling two die A player scores the sum of the two dice thrown (unless the roll contains a 1): Ifa 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 During a single turn, a player may roll the dice as many times as they desire. The scone for a single turn is the sum of the individual scores for each dice roll. The first player to reach the goal score wins unless a player scores higher subsequently in the same round. Ther a. b. c. d. efore, 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 umber of points the game will be played to (1-100 Once a valid goal score has been entered the game will "rol" 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 die again (unless they have "pigged out" by rolling a single 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 Project3. Generally, user input must not be case sensitive. The project must consist of the following classes. Class EntryPoint: contains the main method and instantiation of the GameController class; this class has been provided Class GameController: Manages the flow of 2-player game play o o Overvievw 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 The players each take turns rolling two die A player scores the sum of the two dice thrown (unless the roll contains a 1): Ifa 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 During a single turn, a player may roll the dice as many times as they desire. The scone for a single turn is the sum of the individual scores for each dice roll. The first player to reach the goal score wins unless a player scores higher subsequently in the same round. Ther a. b. c. d. efore, 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 umber of points the game will be played to (1-100 Once a valid goal score has been entered the game will "rol" 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 die again (unless they have "pigged out" by rolling a single 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 Project3. Generally, user input must not be case sensitive. The project must consist of the following classes. Class EntryPoint: contains the main method and instantiation of the GameController class; this class has been provided Class GameController: Manages the flow of 2-player game play o o

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions