VB.NET program help - lottery

harrypotterfan

New Member
Joined
Sep 27, 2005
Messages
2
Can anyone help me with this program?

This will be a console application. I need to pass arrays as arguments to/from procedures and to use them within procedures.

The rules for the Mega Millions game are as follows: Players may pick a total of six numbers from two separate pools of numbers: five different numbers from 1 to 52 (inclusive), and one number from 1 to 52 (inclusive) for selecting the Easy Pick. You win the jackpot by matching all six winning numbers in a drawing. Note that the sixth number may match one of the first five. The first five numbers are unique.

The program specifications are:

1. A stub (MegaMillions Stub) is supplied for use. Included in the sub is an integer function that will return a random number between the values of 1 to 52 (inclusive).

2. Option Strict must be on.

3. Print the first five numbers in ascending order. HINT: use a second (Boolean) to keep track of which balls have been drawn for the first five numbers to make sure there are no duplicates.

4. The drawing of the numbers and their printing must occur in separate procedures, i.e., the program must contain at least one procedure call with an array argument.

5. Provide for looping, i.e., provide for multiple drawings. Make sure all arrays are reset (balls put back into the cage before the "next" drawing. No data validation and case insensitivity is necessary.

6. Use only procedure level variables in the solution. Do not use any variables defined outside a procedure (module variables).

7. Develop the following components for this program. Note each procedure may use, at the author's discretion, other procedures.

a. Sub Main() –driver module
b. A procedure to draw the six random numbers using function drawNumber.
c. A procedure to print the results of the drawing.
d. A procedure to obtain a user's response for another drawing.
e. A procedure to "blank out" the results from the previous drawing.

Here is the stub from #1.

Option Strict On
Module Megamillions
'
'For use in solving the MegaMillions program
'
Sub Main()
'
'Megamillions simulation mainline/driver module
'
End Sub 'Main

Private Function drawNumber() As Integer
' Draws a random number between one and 52 inclusive
Static randomNumber As New Random
Return randomNumber.Next(1, 53)
End Function 'drawnumber
End Module
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,844
Messages
6,181,294
Members
453,030
Latest member
PG626

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top