Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Requested files: Dice.h, Dice.cpp, DiceAndDanger.cpp, DiceAndDanger_test.cpp

With this program, you will begin the practice of breaking source code into distinct modules that are responsible for limited scopes of behavior and data. You will create the framework of a game that uses dice to generate random decisions. This game is called DiceAndDanger.cpp.

Create a class (header and implmentation files) named Dice that can be used to create objects that simulate the behavior of one or more Die. This class should be able to simulate a die with an arbitrary number of sides; for example, it should be able to simulate a three sided die or a 21 sided die.

This class must have at least two public methods:

void roll() - which will simulate rolling a die by returning a random number between 1 and N where N represents the number of sides on the die.

int read() - which will return the value showing on the "top" of the die. This value represents the number of "pips" on the face of the die considered to be the top. If you store the values of the faces of your die in an array, the top should be the first element.

int read(int n) - return the value associated with the nth side of the die.

Your class must have a default constructor that will create a die with 6 sides. It should also have a parameterized constructor which will take an argument that indicates the number of sides that the new die object should contain.

DiceAndDanger.cpp should contain two methods:

rollCharacter(int* attributeArray) which will use 6 rolls of an 18-sided die to determine each of the following character attributes: Strength, Constitution, Dexterity, Intelligence, Wisdom, Charisma.

printCharacter(int *attributeArray) which will print each of the characters attributes and the value rolled: Strength:17,Constitution:12,Dexterity:8,Intelligence:16,Wisdom:11,Charisma:4

After the first set of character attributes is generated, the program should ask:

"Roll another characer? (y/n): "

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93109744

Have any Question?


Related Questions in Computer Engineering

Need guidance on a c program that1 asks the user to input a

Need guidance on a C++ program that: 1. Asks the user to input a number of cents 2. Calculates and displays the number of quarters, dimes, nickels, and pennies that should be used to reach the value. EX: 67 cents would b ...

With more persons working from home how does one separate

With more persons working from home, how does one separate data intended for the employer form what might be considered personal property? What policies could be put in place to ensure employees adhere to safe guidelines ...

What is a good analogy of subnetting whats a break down of

What is a good analogy of Subnetting? What's a break down of how it is used within a company?

A politician claims that the mean salary for managers in

A politician claims that the mean salary for managers in his state is more than the national? mean, ?$83,000. Assume the the population is normally distributed and the population standard deviation is ?$9200. The salarie ...

Hayley motorcycle company just paid a dividend of 14 today

Hayley Motorcycle Company just paid a dividend of $1.4 today, and is expected to pay a dividend in year 1 of $1.8, a dividend in year 2 of $2.3, a dividend in year 3 of $2.9, and a dividend in year 4 of $3.8. After year ...

Reading the biographybook where the body meets memory by

Reading the Biography Book : "Where the Body Meets Memory" by David Mura Questions: On page 62 to 66, David Mura talked about an incident when he was in fifth grade. A bully called Mike Wrangel was trying to beat up anot ...

In class i described the methods used to create gas and

In class, I described the methods used to create gas and gasoline from the carbon in coal. The other ingredients were water and heat energy. First we made 'coal gas' from the carbon in coal  C + H2O → H2 + CO  Then we us ...

Quesiton for completion of the program use arrays and

Quesiton: For completion of the program, use arrays and files. Instead of prompting the user for the prices of the book, update the website program to reflect the following changes: • Read the prices into an array from a ...

Scheduling algorithms are again becoming more important as

Scheduling algorithms are again becoming more important as we look at operating system that run on mobile devices. Are their scheduling algorithms different from those found on traditional interactive system? Compare and ...

For recursion trees why sometime there are 2 recursion

For recursion trees, why sometime there are 2 recursion trees shown. why sometimes the work per level decreases from level to level, and it is constant in each level. The recursion tree shown for merge sort has same tota ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As