Question: VBA Program: 13. Consider the following state lottery. Five random digits are selected. This is the winning number. You can buy as many lottery cards

VBA Program: 13. Consider the following state lottery. Five random digits are selected. This is the winning number. You can buy as many lottery cards as you like at $1 per card. Each card contains five random digits. If you get a card that matches the winning number, you win $100,000. (Assume that order matters. For example, if the winning number is 21345, then 12345 doesnt win.) Write a sub that does the following. It first generates a random winning number and stores it in a string variable (so that you can use string concatenation), and it asks the user how many cards he wants to buy. It then uses a For loop to generate this many cards and store their numbers in a card array (which should be a string array). Next, it uses a Do loop to keep checking cards until a winner has been found or no more cards remain. Finally, it displays a message stating whether you are a winner and your net gain or loss. Note that you can generate a single random digit from 0 to 9 with Excels RANDBETWEEN function.

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!