USING C LANGUAGE ANSWERING QUESTION 2. I've done question 1 and have already read the contents in the file and print it out, i am just stuck on how to scan the winning tickets with the numbers that I have asked the user to generate and printing out the total sales and payout. Examine the rules for the Mega Millions Lottery in the United States of America. Create a program in C which simulates a Mega Millions Lottery according to the text below. Please format all your code according to this style guide: https://codingart.readthedocs.o/en/latest/c/Formatting.html Assume the Jackpot wr fixed at $100 million. Part 1 Generate Tickets (50 %) The program should request input from the user about how many tickets to generate. The program should then generate that number of lottery tickets (you can assume only one set of 6 numbers per ticket). Each lottery ticket should have a unique identifier, the numbers should be random, conform to the rules of the Mega Millions Lottery and the Megaplier option should be randomly decided for each ticket. There is no need to implement Just the Jackpot. These lottery tickets should be saved to a human-readable txt file with the white ball numbers sorted from lowest to highest numerical value. An example of how the human-readable file could look: 1,2,24,35,38,54,3 ,1 2, 10 , 13 , 30,52,69,9,0 3,4,10,45,65,20, 0 4,9,23,52,51,70,2,1 Where the columns are firstly the unique identifier, then the 5 white balls (in sorted order), then the gold ball and finally a binary megaplier option for that ticket. Part 2 Conduct the draw (50%) One set of winning numbers and a Megaplier should be generated (randomly) and printed. The generated file in Part 1 should be read back in and checked against the winning numbers. $400 Print the unique identifier, numbers, and amount won of any lottery tickets that win more than Print summary statistics for won amounts less than $400. This should include the average amount won per ticket, and number of winners at each unique prize amount. Also include the total amount paid out in prizes, the total amount of sales and the total profit. Print the cash vs annuity options for if the Jackpot is won including the expected amount at each year (see the website). Example output could be: You have requestew 200000 tickets Winning numbers: 5 23 29 34 42 | 2 Winning Tickets: Ticket Number 107608 Numbers: 5 23 34 42 64 | 4 Won: $1000 Ticket Number 124916 Numbers: 5 23 34 42 62 | 15 Won: $500 Ticket Number 148504 Numbers: 5 12 23 29 42 | 5 Won: $20000 In addition, without a Megaplier: 2764 won $2 1129 won $4 301 won $10 10 won $200 With a Megaplier: 2772 won $4 1116 won $8 295 won $20 There were 8397 winners in total! The total sales were: $500116 The total payout was: $64870 The average amount won was $7.73 The total profit was: $435246 If the Jackpot is won: Cash option: $100000000 Annuity option: Inital Payment: $1500000 Year 2: payment is $1575000 etc

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 16PP: (Computation) Among other applications, Pascal’s triangle (see Figure 7.22) provides a means of...
icon
Related questions
Question

USING C LANGUAGE ANSWERING QUESTION 2.

I've done question 1 and have already read the contents in the file and print it out, i am just stuck on how to scan the winning tickets with the numbers that I have asked the user to generate and printing out the total sales and payout.

Examine the rules for the Mega Millions Lottery in the United States of America.
Create a program in C which simulates a Mega Millions Lottery according to the text below.
Please format all your code according to this style guide:
https://codingart.readthedocs.o/en/latest/c/Formatting.html
Assume the Jackpot wr fixed at $100 million.
Part 1 Generate Tickets (50 %)
The program should request input from the user about how many tickets to generate.
The program should then generate that number of lottery tickets (you can assume only one set of 6 numbers per ticket).
Each lottery ticket should have a unique identifier, the numbers should be random, conform to the rules of the Mega Millions Lottery and the Megaplier option should be randomly decided for each ticket. There is no need to implement Just the Jackpot.
These lottery tickets should be saved to a human-readable txt file with the white ball numbers sorted from lowest to highest numerical value.
An example of how the human-readable file could look:
1,2,24,35,38,54,3 ,1
2, 10 , 13 , 30,52,69,9,0
3,4,10,45,65,20, 0
4,9,23,52,51,70,2,1
Where the columns are firstly the unique identifier, then the 5 white balls (in sorted order), then the gold ball and finally a binary megaplier option for that ticket.
Part 2 Conduct the draw (50%)
One set of winning numbers and a Megaplier should be generated (randomly) and printed.
The generated file in Part 1 should be read back in and checked against the winning numbers.
$400
Print the unique identifier, numbers, and amount won of any lottery tickets that win more than
Print summary statistics for won amounts less than $400. This should include the average amount won per ticket, and number of winners at each unique prize amount. Also include the total amount paid out in prizes, the total amount of sales and the total profit.

Print the cash vs annuity options for if the Jackpot is won including the expected amount at each year (see the website).
Example output could be:
You have requestew 200000 tickets
Winning numbers: 5 23 29 34 42 | 2

Winning Tickets:
Ticket Number 107608
Numbers: 5 23 34 42 64 | 4
Won: $1000
Ticket Number 124916
Numbers: 5 23 34 42 62 | 15
Won: $500
Ticket Number 148504
Numbers: 5 12 23 29 42 | 5
Won: $20000

In addition, without a Megaplier:
2764 won $2
1129 won $4
301 won $10
10 won $200
With a Megaplier:
2772 won $4
1116 won $8
295 won $20
There were 8397 winners in total!
The total sales were: $500116
The total payout was: $64870
The average amount won was $7.73
The total profit was: $435246
If the Jackpot is won:
Cash option: $100000000
Annuity option: Inital Payment: $1500000
Year 2: payment is $1575000 etc

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage