1.21 - Slot Machine Assignment

1... In this assignment you will be creating a Las Vegas style slot machine (but we will modify it a little). A slot machine looks something like this:

2... Create the following form with one button and five different lables. When you are finished with the basic objects you can add color and images in order to dress it up a little.

3... You will need to declare one global integer variable called intTokens at the very top of you program. This will keep track of the number of tokens the user has left.

4... When the form loads you will have to add code to Randomize, to set intTokens to 20 and to make lblTokens.Text = intTokens.

5... When the user clicks on the Pull button, the following has to occur:
-Three variables have to be declared, intWheel1, intWheel2 and intWheel3.
-These are declared within the Pull command, so they are local variables.

6... If the user has 0 tokens left then a message box should appear saying: "Sorry, no tokens left!"

7... If the user has more than 0 tokens left then intTokens should go down by one, lblTokenMessage.Text should say "Tokens you have left", and lblTokens.Text should display the value of intTokens. Also, you should generate three random numbers for the wheel values. This can be done using the code intWheel1 = Int (3 * Rnd + 1).

6... Once the three random values have been generated, you will need another If statement, this one will be inside the other. This statements will perform the following:
-If all three wheels equal 1 then intTokens go up by 4 and a message box is displayed saying "You won 4 tokens"
-If all three wheels equal 2 then intTokens go up by 8 and a message box is displayed saying "You won 8 tokens"
-If all three wheels equal 3 then intTokens go up by 12 and a message box is displayed saying "You won 12 tokens"

7... You can then end both If statements, and finally you can have lblTokens.Text display the amount of tokens the user has.

8... If you require help with this program please raise your hand and ask you instructor. When you are done, let your instructor take a look at your program.

9... Modifications: When you are done the initial version of the slot machine, here are some alterations to be made:

-Allow the user to enter the numbe of tokens they would like to wager each spin.
-If all three wheels match, the user gets 4 times their wager.
-If any two wheels match, the user gets their wager back.
-If no wheels match, the user loses all of their wager.