Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java write this program PIG, In three different parts. Part 1, Part 2, and Part 3. Assignment Description: This project is made up of

In Java write this program PIG, In three different parts. Part 1, Part 2, and Part 3.

image text in transcribedimage text in transcribedimage text in transcribed

Assignment Description: This project is made up of three parts that are part of a SINGLE java file. First, you will implement a two- player game of Pig that goes to 20 points. Second, you will write another game of Pig where the user plays against the computer. You will have to come up with the strategy of when the computer will stop rolling on each turn (obviously you don't want the computer to keep rolling until they get a 1 each time). Finally you will create another program that runs a simulation that shows how well your computer player strategy works. The three parts are described in more detail below. Part 1 Write the class Proj3 which contains a main method. In this part, you will implement a two-player game of Pig that goes to 20 points. You should alternate between players as described in the background description on the previous page. Once a player has at least 20 points, you will stop the game and display who won. The winning number of points required (20) must be declared as a constant. Hold the screen after this portion is run and then continue on to Part 2. Get Part 1 working before continuing to Part 2! Here is an example run of Part l: You output must look EXACTLY like the following... Player 1 turn total is 0. Enter (r)oll or (s)top: r You rolled: 3 Player 2 turn total is 16. Enter (r)oll or (s)top: s Turn over Current score: Player 1 has 12, Player 2 has 16 Player 1 turn total is 3. Enter (r)oll or (s)top: r You rolled: 4 Player 1 turn total is 0. Enter (r)oll or (s)top: r You rolled: 4 Player 1 turn total is 7. Enter (r)oll or (s)top: r You rolled: 5 Player 1 turn total is 4. Enter (r)o or(s)top: s Turn over Current score: Player 1 has 16, Player 2 has 16 Player 1 turn total is 12. Enter (r)oll or (s)top: s Turn over Current score: Player 1 has 12, Player 2 has 0 Player 2 turn total is 0. Enter (r)ol or(s)top: r You rolled: 2 Player 2 turn total is 0. Enter (r)oll or (s)top: r You rolled: 2 Player 2 turn total is 2. Enter (r)oll or (s)top: r You rolled: 4 Player 2 turn total is 2. Enter (r)oll or (s)top: r You rolled: 5 Player 2 turn total is 6. Enter (r)ol or (s)top: s Turn over Current score: Player 1 has 16, Player 2 has 22 Player 2 wins Player 2 turn total is 7. Enter (r)oll or (s)top: r You rolled: 4 Player 2 turn total is 11. Enter (r)oll or (s)top: r You rolled: 5 Press enter to continue to Part 2.. Assignment Description: This project is made up of three parts that are part of a SINGLE java file. First, you will implement a two- player game of Pig that goes to 20 points. Second, you will write another game of Pig where the user plays against the computer. You will have to come up with the strategy of when the computer will stop rolling on each turn (obviously you don't want the computer to keep rolling until they get a 1 each time). Finally you will create another program that runs a simulation that shows how well your computer player strategy works. The three parts are described in more detail below. Part 1 Write the class Proj3 which contains a main method. In this part, you will implement a two-player game of Pig that goes to 20 points. You should alternate between players as described in the background description on the previous page. Once a player has at least 20 points, you will stop the game and display who won. The winning number of points required (20) must be declared as a constant. Hold the screen after this portion is run and then continue on to Part 2. Get Part 1 working before continuing to Part 2! Here is an example run of Part l: You output must look EXACTLY like the following... Player 1 turn total is 0. Enter (r)oll or (s)top: r You rolled: 3 Player 2 turn total is 16. Enter (r)oll or (s)top: s Turn over Current score: Player 1 has 12, Player 2 has 16 Player 1 turn total is 3. Enter (r)oll or (s)top: r You rolled: 4 Player 1 turn total is 0. Enter (r)oll or (s)top: r You rolled: 4 Player 1 turn total is 7. Enter (r)oll or (s)top: r You rolled: 5 Player 1 turn total is 4. Enter (r)o or(s)top: s Turn over Current score: Player 1 has 16, Player 2 has 16 Player 1 turn total is 12. Enter (r)oll or (s)top: s Turn over Current score: Player 1 has 12, Player 2 has 0 Player 2 turn total is 0. Enter (r)ol or(s)top: r You rolled: 2 Player 2 turn total is 0. Enter (r)oll or (s)top: r You rolled: 2 Player 2 turn total is 2. Enter (r)oll or (s)top: r You rolled: 4 Player 2 turn total is 2. Enter (r)oll or (s)top: r You rolled: 5 Player 2 turn total is 6. Enter (r)ol or (s)top: s Turn over Current score: Player 1 has 16, Player 2 has 22 Player 2 wins Player 2 turn total is 7. Enter (r)oll or (s)top: r You rolled: 4 Player 2 turn total is 11. Enter (r)oll or (s)top: r You rolled: 5 Press enter to continue to Part 2

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

What is quantizing error?

Answered: 1 week ago

Question

What penalty (if any) should Foster receive?

Answered: 1 week ago

Question

=+1. What is the schedule for this project?

Answered: 1 week ago