#### Lab 1280 - Slot Machine

##### Description

In this lab, you will model a slot machine. The machine accepts a dollar from you. Then you spin the reels. When the reels stop spinning, if the symbols line up in a winning combination, you win money from the machine.

Our slot machine has three reels with symbols on some of the 32 possible stop positions for each reel. Many stop positions are blank. Table 1 shows the frequency of each symbol on each reel. Each stop is equally likely.

 Table 1: Reel Strips Stop Reel 1 Reel 2 Reel 3 1 Blank Seven Bars 2 Bars Cherries Blank 3 Blank Bars Blank 4 Blank Bars Blank 5 Bars Blank Cherries 6 Blank Bars Blank 7 Cherries Blank Seven 8 Seven Blank Bars 9 Bars Seven Blank 10 Blank Blank Bars 11 Blank Blank Blank 12 Bars Cherries Blank 13 Seven Blank Bars 14 Cherries Blank Blank 15 Seven Blank Cherries 16 Blank Bars Seven 17 Seven Blank Blank 18 Bars Blank Seven 19 Seven Blank Blank 20 Blank Cherries Bars 21-32 Blank Blank Blank

As a practical note, these are actually virtual reels. A physical reel does not have 32 stop positions. These 32 virtual positions map to one of twenty actual positions. This makes the physical reel small enough to fit in the machine and also makes it appear to have more symbols and a higher chance of payoff.

After our hypothetical dollar is put in the machine, the customer spins the reels. Each reel spins independently and stops on one of the thirty-two equally-likely positions. Once the machine has stopped, some combinations of symbols reward the player with a payout. Here is the pay table for this hypothetical machine:

 Table 2: Pay Table Symbols on Pay Line Payout three sevens \$250 three bars \$75 three cherries \$12 exactly two cherries \$8 only one cherry \$2
##### Assignment

Create a class to model the slot machine described in the tables above. For this machine, the bet is always one dollar. Calculate the expected return on this slot machine by playing many games and then dividing coins won by coins in. For example, if in 100 plays of one dollar each you win a total of \$98, we say the return on the machine is 98%. You should write a TestSlotMachine.java file to track coins in and coins won and report the return on the machine.