Class

In a file called ClassPractice.cpp, you are going to define and implement a PairOfDie class to model dice (perhaps for use in a game that involves rolling dice). Note: in general, class specification and class implementation are separated into a header file (.h) and an implemenation file (.cpp), but for this problem, you will put both the class definition and implemenation into a single file. For the class definition: 1. Name the class: PairOfDie 2. create two private integers named: die1, die2 3. declare a public default noargument constructor 4. declare a second public constructor that takes two integers as arguments 5. declare the following public member functions: a. int getDie1(); b. int getDie2(); c. int roll(); For the class implemenation: 1. Implement the default constructor so that both die1 and die2 are initialized to zero. 2. Implement the second constructor where the two integer arguments are used to initialize die1 and die2 3. Implement both getDie1() and getDie2() member functions to return the appropriate current die value. 4. Implement roll() to randomly assign values in the range 1 to 6 to die1 and die2. This function should return the sum of die1 and die2. Provide a main function that does the following: 1. Create a PairOfDice object named dice. 2. call the roll() member function and print the result 3. call the getDie1() member function and print the result 4. call the getDie2() member function and print the result 5. call the roll() member function again and print the result again

   Related Questions in C/C++ Programming