first need to define the properties and behaviors of a single die that can be reused multiple times in your future code. This will be done by creating a Dice class. Create a Dice class that contains the following members: Two private integer variables to store the minimum and maximum roll possible. Two constructors that initialize the data member
first need to define the properties and behaviors of a single die that can be reused multiple times in your future code. This will be done by creating a Dice class. Create a Dice class that contains the following members: Two private integer variables to store the minimum and maximum roll possible. Two constructors that initialize the data member
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
Dice Rolling Class
In this problem, you will need to create a program that simulates rolling dice. To start this project, you will first need to define the properties and behaviors of a single die that can be reused multiple times in your future code. This will be done by creating a Dice class.
Create a Dice class that contains the following members:
Two private integer variables to store the minimum and maximum roll possible.
Two constructors that initialize the data members that store the min/max possible values of rolls.
a constructor with default min/max values.
a constructor that takes 2 input arguments corresponding to the min and max roll values
Create a roll() function that returns a random number that is uniformly distributed between the minimum and maximum possible roll values.
Create a small test program that asks the user to give a minValue and maxValue for a die, construct a single object of the Dice class with the constructor that initializes the min and max values for the die as minValue and maxValue, respectively, and then roll the die 10 times. Each time the die is rolled, print the value of the roll to the terminal using cout.
Remember to set up your random number generation correctly for your test program.
Example Output
Example 1 (user input is underlined):
Let's set up a die to roll. What are the minimum and maximum values for this die?
Minimum Value: 1
Maximum Value: 6
The die is rolled 10 times. The results of those rolls are:
Roll #1 was: 1
Roll #2 was: 2
Roll #3 was: 4
Roll #4 was: 4
Roll #5 was: 1
Roll #6 was: 4
Roll #7 was: 4
Roll #8 was: 2
Roll #9 was: 6
Roll #10 was: 2
Example 2 (user input is underlined):
Let's set up a die to roll. What are the minimum and maximum values for this die?
Minimum Value: 3
Maximum Value: 11
The die is rolled 10 times. The results of those rolls are:
Roll #1 was: 3
Roll #2 was: 9
Roll #3 was: 11
Roll #4 was: 3
Roll #5 was: 6
Roll #6 was: 3
Roll #7 was: 4
Roll #8 was: 6
Roll #9 was: 6
Roll #10 was: 7
Name the source code file username_hw6A.cpp.
Pls send me solution fast within 20 min and i will rate instantly for sure!!
Solution must be in typed form!!
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 2 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