Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ In MegaMillions, players may pick six numbers from two separate pools of numbers five different numbers from 1 to 70 (white ball) and one

C++

In MegaMillions, players may pick six numbers from two separate pools of numbers five different numbers from 1 to 70 (white ball) and one number from 1 to 25 (mega ball). In PowerBall, players pick five different numbers from 1 to 69 (white ball) and one number from 1 to 26 (power ball). In each MegaMillions or PowerBall drawing, five random and non-repetitive numbers will be drawn from white balls, and one random number from the mega/power balls. You win the jackpot by matching all six winning numbers in a drawing.

1. Display your standard output information using a function named ShowProgramHeader()

2. Ask the user to select which lottery to play: MegaMillions or PowerBall

3. Get input from user in an array: five numbers for white ball and one additional number for mega or power ball

4. Write functions to:

a. Generate an array and initialize it with numbers 1 to 70 (MegaMillions) or 1 to 69 (PowerBall),

b. Shuffle the elements in the array and take the first five elements (so you get five random and non-repetitive numbers). To shuffle the elements, just swap each element with a random element in the array.

c. Get a random number from 1 to 25 (mega ball) or 1 to 26 (power ball), and

d. On screen, show output from steps b. and c. as the result of a drawing, and compare with the user input in step 3 to show whether the user wins the jackpot.

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

Step: 3

blur-text-image

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

How was your life influenced by those events?

Answered: 1 week ago

Question

Which of these influenced your life most dramatically?

Answered: 1 week ago