Write a program like
Projectile.exe.
It is a variation of the ColorGridRow program we looked at on Wednesday. It must use
a loop! It draws ellipses instead of rectangles. Like ColorGridRow, the horizontal
position is determined by some number times your counter. The vertical position
is determined by some number times your counter squared. Shades of gray are obtained
by having the same amount of red, green and blue.
Using a NumericUpDown control the user enters a number of dollars to start with.
A spin of the roulette wheel is simulating using a random number generator draw
a number between 1 and 38. The numbers 1 through 36 are themselves and 37 and 38
correspond to 0 and 00.
According to http://en.wikipedia.org/wiki/Roulette {1, 3, 5, 7, 9, 12, 14, 16, 18, 19,
21, 23, 25, 27, 30, 32, 34, 36} are Red; {2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26,
28, 29, 31, 33, 35} are Black; and 0 and 00 are Green.
Assuming the player bets on Red, determine if the player has won or lost a
dollar and adjust the player's amount. (I used a Select Case because it will accept a
comma-separated list.)
The player continues to bet while he/she has money. Count the number of spins
of the wheel needed for the player to lose his/her money.
Place the above in a loop that repeats the simulation process the number of
times requested by the user. (Don't forget to reset the player's amount and the spin
counter.)
Keep a history of the number of spins needed in a ListBox.
Calculate the average number of spins.
Clear out the results if the user changes any input.
Make sure the user enters a number for the sample size.
Friday:
HBD.zip RouletteSpin.zip We reviewed the spin of a roulette wheel that was
used in Wednesday's lab. Loan.zip We started a program to determine how many months it would take
to pay off a loan. Uses a while (until) loop.