Using the attached diceType, create a class rollType that holds information for a roll of several dice simultaneously.  rollType should contain the number of dice being rolled and a pointer to a dynamic array of diceType. (2) Create a client program to test your implementation that creates a dice roll whose size is based on the user's input. Step 1: Define remaining member functions Step 2: Complete test program Notes: DO NOT modify anything in diceType.h or diceTypeImp.cpp. **I just need your best guess at filling in the stub functions for this assignment and an updated test file. It doesn't have to be all that correct. I've attached the two diceType files as images. Only the rollDice ones need altering.** //diceRollType header file #ifndef DICE_ROLL_TYPE_H #define DICE_ROLL_TYPE_H #include "diceType.h" class diceRollType { public: void getResults() const; void rollDice() const; diceRollType(int = 1); ~diceRollType(); diceRollType(const diceRollType &otherDice); private: diceType *diceList; int numDice; }; //diceRollTypeImp file #include #include #include "diceRollType.h" using namespace std; void diceRollType::getResults() const { } void diceRollType::rollDice() const { } diceRollType::diceRollType(int n){ numDice = n; diceList = new diceType[numDice]; } // Copy Constructor diceRollType::diceRollType(const diceRollType &otherDice) { } diceRollType::~diceRollType(){ } //diceRollType test file #include #include "diceRollType.h" using namespace std; void PrintRoll(diceRollType dice); int main(){ int numDice; cout << "How many 6-sided dice do you want? "; cin >> numDice; diceRollType dice(numDice); dice.rollDice(); PrintRoll(dice); dice.getResults(); return 0; } void PrintRoll(diceRollType dice){ dice.getResults();

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
icon
Related questions
Question
100%

Using the attached diceType, create a class rollType that holds information for a roll of several dice simultaneously.  rollType should contain the number of dice being rolled and a pointer to a dynamic array of diceType. (2) Create a client program to test your implementation that creates a dice roll whose size is based on the user's input.

  • Step 1: Define remaining member functions
  • Step 2: Complete test program

Notes:

  • DO NOT modify anything in diceType.h or diceTypeImp.cpp.

**I just need your best guess at filling in the stub functions for this assignment and an updated test file. It doesn't have to be all that correct. I've attached the two diceType files as images. Only the rollDice ones need altering.**

//diceRollType header file

#ifndef DICE_ROLL_TYPE_H
#define DICE_ROLL_TYPE_H

#include "diceType.h"

class diceRollType {
public:
void getResults() const;
void rollDice() const;

diceRollType(int = 1);
~diceRollType();
diceRollType(const diceRollType &otherDice);

private:
diceType *diceList;
int numDice;
};

//diceRollTypeImp file

#include <iostream>
#include <iomanip>
#include "diceRollType.h"

using namespace std;

void diceRollType::getResults() const {

}

void diceRollType::rollDice() const {

}

diceRollType::diceRollType(int n){

numDice = n;
diceList = new diceType[numDice];
}

// Copy Constructor
diceRollType::diceRollType(const diceRollType &otherDice) {

}

diceRollType::~diceRollType(){

}

//diceRollType test file

#include <iostream>
#include "diceRollType.h"

using namespace std;

void PrintRoll(diceRollType dice);

int main(){
int numDice;

cout << "How many 6-sided dice do you want? ";
cin >> numDice;

diceRollType dice(numDice);

dice.rollDice();

PrintRoll(dice);

dice.getResults();

return 0;
}

void PrintRoll(diceRollType dice){

dice.getResults();
}

Start here X
A diceType.h X
A diceTypelmp.cpp x
1
3
#include <iostream>
4
#include <cstdlib>
#include <ctime>
#include "diceType.h"
7
using namespace std;
diceType::diceType (int sides)
10
11
srand (time (nullptr) );
numSides = sides;
12
13
14
numRolled = (rand () $ numSides) + 1;
15
16
int diceType::roll ()
17
18
19
numRolled = (rand () $ numSides) + 1;
20
21
return numRolled;
22
23
int diceType ::getNum () const
25
26
return numRolled;
27
28
NN N NN
Transcribed Image Text:Start here X A diceType.h X A diceTypelmp.cpp x 1 3 #include <iostream> 4 #include <cstdlib> #include <ctime> #include "diceType.h" 7 using namespace std; diceType::diceType (int sides) 10 11 srand (time (nullptr) ); numSides = sides; 12 13 14 numRolled = (rand () $ numSides) + 1; 15 16 int diceType::roll () 17 18 19 numRolled = (rand () $ numSides) + 1; 20 21 return numRolled; 22 23 int diceType ::getNum () const 25 26 return numRolled; 27 28 NN N NN
#ifndef H_diceType
2
#define H diceType
3
4
class diceType
5
6
public:
7
diceType (int
= 6);
// Default constructor
// Sets muSides to 6 with a random munRolled from 1 - 6
10
int roll () :
// Function to roll a dice.
// Randomly generates a number between 1 and pumSides
11
12
13
14
//
and stores the number in the instance variable puRolled
15
//
and returns the number.
16
int getNum () const;
// Function to return the number on the top face of the dice.
// Returns the value of the instance variable punRolled.
17
18
19
private:
22
int numSides;
23
int numRolled;
24
25
#endif // tnType
26
N22 N222
Transcribed Image Text:#ifndef H_diceType 2 #define H diceType 3 4 class diceType 5 6 public: 7 diceType (int = 6); // Default constructor // Sets muSides to 6 with a random munRolled from 1 - 6 10 int roll () : // Function to roll a dice. // Randomly generates a number between 1 and pumSides 11 12 13 14 // and stores the number in the instance variable puRolled 15 // and returns the number. 16 int getNum () const; // Function to return the number on the top face of the dice. // Returns the value of the instance variable punRolled. 17 18 19 private: 22 int numSides; 23 int numRolled; 24 25 #endif // tnType 26 N22 N222
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
User Defined DataType
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education