Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java FX GUI application to play the game of Yahtzee. Yahtzee is a dice game that can be played by any number of

Write a Java FX GUI application to play the game of Yahtzee. Yahtzee is a dice game that can be played by any number of players. You will be implementing the single-player version of the game. These are the rules that should be used for scoring except for the rules regarding multiple Yahtzees. After the first Yahtzee has been scored, additional Yahtzee will only be given the points for the category in which it is used. Yahtzees cannot be used as jokers and will not be awarded 100-point bonuses. The interface should resemble the following screen shot below.

The form window must include a visual representation of the 5 dice that are rolled throughout the game. The dice must use the dot representation as shown in the screen shot, however you may display them in any color(s) you like. When the application begins, the dice should all display blank faces (no dots). There should be a checkbox next to each die that when checked holds the die so it will not be re-rolled. If you so desire, you may replace this hold mechanism with something fancier like clicking the dice and having them change state, as long as it clear to the user whether a die is being held or not. When the dice are rolled, the hold checkboxes (or other visual hold representation) should be reset so that no dice are held. The checkboxes (hold mechanism) should be disabled under the following three conditions:

the user has completed his third roll in that round and therefore may not re-roll anymore the dice are in the middle of rolling

the current game has ended or has not yet begun.

The application must also include a button that when clicked rolls the dice. The button should be disabled under the following three conditions:

the user has selected all 5 hold checkboxes

the user has completed his third roll in that round and therefore may not re-roll anymore

the dice are in the middle of rolling.

Finally, the form must include three scoring sections: upper, lower, and grand total score. The upper section should include read-only textboxes to display the scores for each of the six categories. The text in the box should be blank at the beginning of a game and only filled in with the score after the category has been selected to score that round. Next to each box, there should be a button with the name of the category. When the user clicks on the button, the score for the corresponding category is calculated for the current dice configuration, then the dice are rolled to begin the next round (except for the final category selected). If the user clicks on the button for a category that has already been scored, it has no effect. The category buttons should be disabled under the following three conditions:

the application has just started

the dice are in the middle of rolling

the current game has ended or has not yet begun.

They become enabled when the roll button is clicked to begin the next game. The upper section should also include read-only textboxes and accompanying labels for the Total Score (subtotal), 63+ bonus, and upper total. These textboxes should remain blank until all six categories in the upper section are scored. The lower section should behave in the same way as the upper section. The grand total section should contain read-only textboxes and accompanying labels for the upper total, lower total, and the sum of the two. Again, the textboxes should start off blank. The upper and lower totals should each be filled out when the respective section is completed. At the end of the game, the grand total appears in the grand total box, and the game simply waits for the roll dice button to be clicked to start a new game. When a dice roll is initiated by either the roll dice button or by one of the category buttons, the dice should change to a new random configuration. The change should not happen immediately, however. Instead, the dice should change through a series of random configurations before settling on the final configuration, thereby simulating the look of a real dice roll. The roll should cause the dice to pass through roughly 5-15 configurations in 0.5-1.5 seconds. Use Timer and Random. To reinforce what was stated previously, all buttons and checkboxes should be disabled while the dice roll is taking place. To the best of your ability, you should separate the rules and play of the game from the interface in your implementation. Dice provided by link down below . Set the title to Yahtzee! and center the stage on the screen. Place all classes into one file. Refer to the sample output below.

image text in transcribed

Name the program: GUIYahtzeeXX.java, where XX are your initials.

Dice: https://uploadfiles.io/dg7fm

E All Kinds of Yahtzee Excitement Upper 1 s) | 31 Aces(Total Twos [Total 2's) Threes ITotal 3's) Fours (Total 4's Fives (Total 5's) Sixes(Total 6's] | | 23 0 25 3 of a Kind 4 of a Kind Full House Small Straight Large Straight Yahtzee Chance 16 0 24 | 50 Total Score 72 onus 35 Upper Total 107 Lower Total Upper Total 107 Lower Total: Grand Total Roll Dice E All Kinds of Yahtzee Excitement Upper 1 s) | 31 Aces(Total Twos [Total 2's) Threes ITotal 3's) Fours (Total 4's Fives (Total 5's) Sixes(Total 6's] | | 23 0 25 3 of a Kind 4 of a Kind Full House Small Straight Large Straight Yahtzee Chance 16 0 24 | 50 Total Score 72 onus 35 Upper Total 107 Lower Total Upper Total 107 Lower Total: Grand Total Roll Dice

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions