A lottery commission offers four different lottery games to play: Three-number,
ID: 3558660 • Letter: A
Question
A lottery commission offers four different lottery games to play: Three-number, Four-number, Five-number and Five-number + 1 lotteries. Each game has independent numbers. Develop an application that randomly picks numbers for all four games and displays the generated numbers in a GUI. Declare a method that generates a random number based on a range given, and returns the random number as a String. The games are played as follows: a) Three-number lotteries require players to choose three numbers in the range 0-9 b) Four-number lotteries require players to choose four numbers in the range 0-9 c) Five-number lotteries require players to choose five number in the range 1-39. d) Five-number + 1 lotteries require players to choose five numbers in the range 1-49 and an additional number in the range 1-42.
Explanation / Answer
First of all: Welcome to the VBForums
Secondly, you have posted in the correct forum and there are many people here that are willing to help you with whatever problem, large or small, that you have with your programming task. However people here will not write complete solutions for you, that is your job.
Since your taking a VB class I assume it's because you want to learn something about VB and programming in general. If I (or someone else) would write this little lottery program for you, you wouldn't have learned a thing. If I write it it would most likely look very different from what it will look when you have written it. I don't know how far into this class you are and what you supposed to have learned this far. I might have used some generic list to store random numbers in and you might not even suppose to know what a generic list is.
If you instead of posting your whole assignment would have asked "How do I generate a random number?" you would have got an answer a long time ago.
I don't know what kind of application you are suppose to write, is it a Windows Forms app or a console app? But here are some steps you can follow using some very basic constructs that are available in VB (which I assume you have been taught by now, and I'm also assuming that this is a console app).
Have a look at some of the google results posted by jmcilhinney on how to generate a random number.
Create a For loop that will generate each number. (1 to 3 for the first lottery).
Inside the loop simply create a random number and print it to the screen (using Console.Write or Console.WriteLine).
Repeat the same thing for the other lottery tickets, increasing the loop for each.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.