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();
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
- 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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F96af0b8b-6e09-4e68-b401-00444c6a5e5b%2Fe38c689a-2d4f-4cb2-9f47-d5dce636d5e6%2Fv2ugxiq_processed.jpeg&w=3840&q=75)
![#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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F96af0b8b-6e09-4e68-b401-00444c6a5e5b%2Fe38c689a-2d4f-4cb2-9f47-d5dce636d5e6%2Fv8sjns9_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)