Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

a. Do team members trust each other?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago