Create objects that simulate the behavior of one die

Assignment Help Computer Engineering
Reference no: EM132122278

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): "

Reference no: EM132122278

Questions Cloud

Would you expect this technique to be faster : You cannot afford to use one million pigeon-holes, so you decide instead to use one thousand pigeon-holes numbered from 0 to 999.
What are the possible downsides of momentum investing : What are the possible downsides of momentum investing? Is it worth it do utilise this approach?
Are there any cases in which these approaches yield the same : How is bipartite clustering (co-clustering) different from clustering the sets of objects and attributes separately?
Matt johnson delivers newspapers and is putting away : Matt Johnson delivers newspapers and is putting away ?$15 at the end of each month from his paper route collections.
Create objects that simulate the behavior of one die : 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.
What is the annual percentage rate of the loan : Assuming there are 360 days in a year and Grant currently holds no funds at the lending bank, what is the annual percentage rate (APR) of the loan?
What is ram receivables collection period : What is RAM's receivables collection period (DSO)? In your computations, assume there are 360 days in a year.
Draw the moore type fsm slate diagram : Overlaps must be considered Also, assume that the reset suite is one in which you know nothing about the history of the sequence.
Develop a program that will record and process the rainfall : Develop a program that will record and process the rainfall totals of a 12 month period. You would use an array to store each month's total.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Define second criterion for a cryptographic hash function

Define the first criterion for a cryptographic hash function. Define the second criterion for a cryptographic hash function.

  What sorts of issues will need to be considered

To improve performance, your company has decided to replicate its product database across several servers so that not all transactions go through a single system. What sorts of issues will need to be considered?

  What is the correct total time and what is critical path

Forest Point Construction At Forest Point Construction, your boss says that he can estimate the total project time based on his personal experience.

  Develop the logic for a program that would produce a table

Develop the logic for a program that would produce a table for the school. Each row represents the number of lessons taken: 0-9, 10-19, 20-29, and 30 or more.

  Questionone of compensation to writing a program that is

questionone of compensation to writing a program that is subdivided into modules is that such a structure allows unlike

  Produce a random starting configuration and print it

In your program, produce a random starting configuration and print it. Then keep applying the solitaire step and print the result.

  Determine the system function of the overall cascade system

The diagram in Fig. depicts a cascade connection of two linear time-invariant systems; i.e., the output of the first system is the input to the second system.

  Discuss how the modern cpus function

The text discusses how modern CPUs function. Recently a critical flaw in microprocessor design has been discovered that allows two extremely serious security.

  Describe the difference between noise and distortion how

question 1 what is the difference between noise and distortion? how can noise and distortion be introduced into a

  Why does a change of case help make a stronger password

Why does a change of case help make a stronger password? How did you choose the password you currently have? Could others follow the same logic and choose a similar password?

  Create a button to save the content of listbox to database

Create a button to save the content of the listbox to the database. Create a button to retrieve the content of the table into the listbox.

  Create an application that displays payroll information

To create an application that displays PAYROLL information. The application should allow the user to enter the following data for four employees Number of hours worked.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd