Question: Write an assembly language program that will simulate a drawing of the Mega Millions lottery (see a description of how the game works and a

Write an assembly language program that will simulate a drawing of the Mega Millions lottery (see a description of how the game works and a list of prizes at http://www.megamillions.com/how-to-play. Your program must define and create an instance of a structure that represents a possible result of a draw (five white balls drawn from a drum containing numbers 1 through 70, plus one yellow Megaball from a second drum containing numbers 1 through 25). You must fill the structure with five different randomly chosen numbers 1-70 plus one randomly chosen number 1-25 (hint: use Irvines Randomize and RandomRange procedures) to simulate the lottery draw. Here is an example code

Different Cases for Mega Millions: ----------------------------------------- case 1: 0 white 0 yellow -- $0 case 2: 0 white 1 yellow -- $2 case 3: 1 white 0 yellow -- $0 case 4: 1 white 1 yellow -- $4 case 5: 2 white 0 yellow -- $0 case 6: 2 white 1 yellow -- $10 case 7: 3 white 0 yellow -- $10 case 8: 3 white 1 yellow -- $200 case 9: 4 white 0 yellow -- $500 case 10: 4 white 1 yellow -- $10,000 case 11: 5 white 0 yellow -- $1,000,000 case 12: 5 white 1 yellow -- Jackpot Macro Example: (before .DATA section) ----------------------------------------- mExample MACRO n mov eax, n ENDM Calling the Macro: (in .CODE section) ----------------------------------------- mExample 25 Structure Example: (in .DATA section) ----------------------------------------- EXAMPLE STRUCT blabla DWORD ? EXAMPLE ENDS Initializing Structure: (in .DATA section) ----------------------------------------- examp EXAMPLE <> Accessing in Structure: (in .CODE section) ----------------------------------------- mov examp.blabla, eax

Example program output follows: Mega Millions drawing results:

White balls 43 17 1 56 22 ... Yellow ball 11 Please enter your first white number: 6 Please enter your second white number: 17 Please enter your third white number: 56 Please enter your fourth white number: 22 Please enter your fifth white number: 1 Please enter your yellow number: 6 You have matched 4 white numbers but not the yellow number. Your ticket wins $100!

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!