Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Java program that lets the player play a simplified game of Yahtzee . The game starts with the user throwing five 6-sided dice.

Create a Java program that lets the player play a simplified game of Yahtzee . The game starts with the user throwing five 6-sided dice. The user can choose which dice to keep and which dice to re-roll. The user can re-roll a maximum of 2 times. After two times, the user has 5 dice with a certain value. The player then has to choose where they want their final combination of dice values applied.

The following list is a simplified Yahtzee card, which we will use for this game: Ones, Twos, Threes, Fours, Fives, Sixes, 3 of a kind, 4 of a kind, Full House, Straight, Yahtzee

For a Full House, the player needs 3 of a kind AND 2 of a kind. For a Straight, the player needs to have all 5 dice in consecutive order, i.e. either 1 ,2, 3, 4, 5, or 2, 3, 4, 5, 6. Yahtzee means 5 of a kind. If the player applies his dice score to something inapplicable, e.g. the player only has 2 of a kind, but applies it to 3 of a kind, or the player has no Ones, but applies his dice result to the Ones category, he scores zero in this category. Implementing the Bonus, Small Straight, and Chance (as usually available in most Yahtzee games) is not required for this homework exercise.

Requirement : You will need a random number generator for the dice roll. Make use of objects , which means either create a Dice class for the 5 dice, or implement a class that represents the 5 dice together (the choice is up to you.) Also, as mentioned, the player can re-throw his dice up to two times. The player can chose which dice to re-throw and which to keep.

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago