Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

2. Outline the business case for a diverse workforce.

Answered: 1 week ago