Problem

Your state is in a process of creating a weekly lottery. Once a week, five distinct rand...

Your state is in a process of creating a weekly lottery. Once a week, five distinct random integers between 1 to 40 (inclusive) are drawn. If a player guesses all of the numbers correctly, the player wins a certain amount. Write a program that does the following:

a. Generates five distinct random numbers between 1 and 40 (inclusive) and stores them in an array.

b. Sorts the array containing the lottery numbers.

c. Prompts the player to select five distinct integers between 1 and 40 (inclusive) and stores the numbers in an array. The player can select the numbers in any order, and the array containing the numbers need not be sorted.

d. Determines whether the player guessed the lottery numbers correctly. If the player guessed the lottery numbers correctly, it outputs the message ‘‘You win!’’; otherwise it outputs the message ‘‘You lose!’’ and outputs the lottery numbers. Your program should allow a player to play the game as many times as the player wants to play. Before each play, generate a new set of lottery numbers.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT