In java please Make a program to simulate a lottery first ask the user if they w
ID: 3792041 • Letter: I
Question
In java please
Make a program to simulate a lottery first ask the user if they would like to pick their own numbers or have the computer pick for them. If they choose to pick their own ask them to pick 6 numbers between 1 and 49 as a single string input with commas between the numbers. If they choose for the computer to pick for them then pick 6 numbers at random. Order doesn’t matter but check that there are no duplicates, and all the chosen numbers are within range. If all the numbers are valid write the string to a file called “TicketsSold.txt” loop so as to generate 100 tickets
Valid input Example: 5,7,34,2,41,37
Invalid input Example: 7,7,7,7,53,7
Create a second program to run the lottery draw, ask the user if they would like a full winner, partial winner or no winners this week.
if they choose full winner read TicketsSold.txt and pick a random ticket and display it as the winning numbers.
if they choose partial winner read TicketsSold.txt and pick 6 numbers between 1 and 49 such that at least one of the tickets sold have >3 matching numbers.
if they choose no winner read TicketsSold.txt and pick 6 numbers between 1 and 49 such that none of the tickets sold have >3 matching numbers.
Explanation / Answer
PART-1 : Lottery Simulator
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
PART 2 - LotteryDrawSimulator
-------------------------------------------------------------------------
PS: Sorry for not completing the second program, because it was too long and couldn't be completed in under 2hrs, but I have commented in the places where it needs small additions, you can go through it and easily understand. The second condition and the third condition are incomplete, and the same guidlines need to be followed as the first condition.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.