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
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