Question
Objectives: To learn how to write a simple game program using top down design. To learn how to program using one dimensional arrays. To learn
Objectives:
To learn how to write a simple game program using top down design.
To learn how to program using one dimensional arrays.
To learn how to use object oriented programming by using class design
To learn how to pass arrays to functions.
To provide appropriate documentation and use of good programming style.
Description of the problem:
Write a simple menu-driven program called Game of Dice. The dice that we are using for this game are special oriental dice. Each die has six different patterns. The six possible patterns are: Fish, Shrimp, Crab, Chicken, Golden_coin, Magic_barrel. This game has two dice.
In this game, the player can place his or her bet on any die-pattern. The amount of the winning prize is directly proportional to the number of matched dice after the three dice have been tossed for each game.
Rules of this game:
Initial cash for this game is specified by player.
Maximum bet for each game is $5000.
Minimum bet for each game is $10.
Two dice are used per game.
Player can place his or her bet on anyone of those six face-patterns of the dice for each game.
The winning prize is based on how many matched dice have been found:
If one matched die has been found, then the prize is 2x.
If two matched dice have been found, then the prize is 4x.
If no matched die has been found, then the player loses his or her bet for this game-session.
Example of a menu could look like the following:
|
Optional: The menu-screen could be graphical, instead of text based screen.
Hints:
enum dicePattern { Fish = 1, Shrimp, Crab, Chicken, Golden_coin, Magic_barrel };
To generate a random number between 1 to 6: rand() % 6 + 1
Requirement:
Your program has to be implemented with a class called Dice.
The class Die should posses the following characteristics:
Die() .. constructor function used to initialize the dice.
Roll() .. used to randomly generate the face value of a dice.
Get() .. used to get the face value of a dice.
A private member variable called Face with data type dicePattern.
Feel free to add any other features that you deem necessary.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started