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();

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 5RQ
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT