In this exercise, you will design a class that models a 6-sided die. The die will be used in a game. An ADT (abstract data type) is a description of the object you are designing. When designing the ADT, first think of the data that you need to obtain from the die. The only value of interest is the value of the top face. The top face of the die shown here is 6. We will call this the value. Observe that the value of the die is an integer in the range 1–6, inclusive. This can be represented by a single integer. We begin the ADT with the data that defines the object: Class data: int value The most important part of the ADT is the functionality. What must a die be able to do? Certainly, we will want to be able to roll the die. When we roll the die, we will want to know the value. We come up with the following function: //simulate a roll of the die, return a random value from {1,2,3,4,5,6} rollDie(): int Is there anything else a die must be able to do? Allow for more than 6 sides? Be 'weighted' so that some outcomes are more likely than others? This is all up to you, the designer.
In this exercise, you will design a class that models a 6-sided die. The die will be used in a game. An ADT (abstract data type) is a description of the object you are designing. When designing the ADT, first think of the data that you need to obtain from the die. The only value of interest is the value of the top face. The top face of the die shown here is 6. We will call this the value. Observe that the value of the die is an integer in the range 1–6, inclusive. This can be represented by a single integer. We begin the ADT with the data that defines the object: Class data: int value The most important part of the ADT is the functionality. What must a die be able to do? Certainly, we will want to be able to roll the die. When we roll the die, we will want to know the value. We come up with the following function: //simulate a roll of the die, return a random value from {1,2,3,4,5,6} rollDie(): int Is there anything else a die must be able to do? Allow for more than 6 sides? Be 'weighted' so that some outcomes are more likely than others? This is all up to you, the designer.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
After reading the photo these would be the next steps
3-Once you have determined the what die date type is and how the data type must be able to act in solution you can create the UML.
4-Once you are done with the UML diagram being the implementation of the class
5-Write a driver program that creates an array of 5 Die objects. Roll the 5 die 100,000 times and count the number of times you roll 3 of a kind, 4 of a kind, and 5 of a kind
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education