Question: Using C++, write an application that will play a slot machine keeping count until it wins. The application will have three classes. Apply some format

Using C++, write an application that will play a slot machine keeping count until it wins. The application will have three classes. Apply some format to the output. It should include these classes:

- A class named Reel that will simulate a slot machine reel. Reel will have a string array with 20 possible faces. Here are the faces it should use:

lemon, cherry, banana, seven, diamond, bell, heart, star, strawberry, grape, bell, horseshoe, heart, pear, orange, 10, king, queen, jack, joker. Reel will have a function called spin that will spin the reel and land on one of the twenty faces. Reel will have other get functions that will retrieve data pertaining to what face was landed on during the spin

- A class named SlotMachine that will simulate the slot machine. SlotMachine will contain an array of three Reel objects. SlotMachine will have a function called Play that will spin each of the Reel objects once and decide if the user won and print out the faces spoon and if the user won.

- The class containing main. In the main an object of class SlotMachine will be instantiated. The SlotMachine object will play until the user is a winner. Main will keep track of how many times the user has played and will display the number of times played once the user has one.

The application should use the standard form of the C++ header files, meaning the class definitions will be in the .h (Reel.h, SlotMachine.h) files and the implementation of the functions will be in the .cpp files (Reel.cpp, SlotMachine.cpp).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!