Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. Write a class called OneRoundOneRollYahtzee. The program should behave the same as the InputorGenerateDiceRolls program with the following additional feature. After each set of

image text in transcribed
image text in transcribed
image text in transcribed
5. Write a class called OneRoundOneRollYahtzee. The program should behave the same as the InputorGenerateDiceRolls program with the following additional feature. After each set of five dice rolls has been displayed in non-decreasing order, the set of five dice rolls will be scored according to the rules of the dice game Yahtzee. Before the score for the roll can be determined, the user must be prompted for a category to be used for scoring the dice roll. The categories are listed on the next two pages which come from: Note that the first six categories (collectively called the "upper section") and category 13 (called "Chance") can be chosen for any set of five dice rolls. However, categories 7-12 are only legal for certain dice rolls. If the user chooses a legal category for the dice roll, your program should compute the score as specified in the Scores column of the tables. However, if the user chooses an illegal category for the dice roll, your program should notify the user that his/her choice is illegal and allow him/her to select again. Note that we are not simulating the full game of Yahtzee. We are only simulating one round of the game and the five dice are only being rolled once during this round. If the user chooses to play again he/she will be starting a new one- round game with all of the scoring categories available in the sense that they are un-used. Please enter 1) to roll your own dice, 2) to let the computer roll the dice, or 3) to quit: 1 Please enter the five dice rolls: 42611 The five rolls in non-decreasing order are: 11246 You may select from the following scoring categories: Upper Section: 1. Aces 2. Twos 3, Threes 4. Fours 5. Fives 6. Sixes Lower Section: 7. Three of A Kind 8. Four of A Kind 9. Full House 10, Small straight 11. Large Straight 12... Yahtzee 13, Chance Please enter the number corresponding to your chosen category: 12 The Yahtzee category is not legal for this roll: 1 1246. Please enter the number corresponding to your chosen category: 13 Your score for the Chance category is: 14. Please enter 1) to roll your own dice, 2) to let the computer roll the dice, or 3) to quit: 3 Have a nice day

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago