Question
HELP! NEEDED IN BASIC BEGINNER JAVA WITH NO CASES! PLEASE NOTHING SUPER COMPLICATED- NEEDED FOR AN INTRO LEVEL PROGRAMMING CLASS. Write a program that simulates
HELP! NEEDED IN BASIC BEGINNER JAVA WITH NO CASES! PLEASE NOTHING SUPER COMPLICATED- NEEDED FOR AN INTRO LEVEL PROGRAMMING CLASS.
Write a program that simulates a basic lottery. Your user will purchase one lottery ticket. Each ticket will contain 5 numbers. Each number will be between 1 and 70, inclusive. You will allow the user to select their own numbers for their ticket or to have the computer randomly select the numbers. You should represent the ticket using an array. Once the ticket has been purchased, your program will randomly generate the winning lottery numbers and determine if the user has won. The winning lottery numbers should be stored in a separate array. Heres the fun part your program should continue to generate a full set of winning lottery numbers drawings until your user wins the lottery.
Your program will count the number of lottery drawings it takes to win.
A few things to consider: The program should contain the following methods
o A main method
o A method that determines the users ticket numbers
o A method that determines the winning lottery numbers
o A method that determines if the user has a winning ticket
o A method that displays the following to the screen: A message indicating the win
The numbers in the users ticket when the win occurred
The winning lottery ticket numbers
The number of times it took to get a match with a winning ticket
The number of times each value 1-70 was generated for a winning lottery ticket
The number(s) generated most often for the winning lottery tickets during this run of the program
For the sake of simplicity, you should implement your code to prevent duplicate values in the lottery tickets (ie a specific number should only appear one time in any ticket). You will need to write code to ensure the user doesnt select the same number twice and that the computer doesnt generate the same number twice. The numbers do not have to match in order. For example, a user ticket with numbers 1, 2, 3, 4, 5 should be considered a match if the winning ticket numbers are 5, 2, 1, 3, 4.
You must validate all user input. Numeric output should be displayed with commas The code should be written using efficient processing. Remember to use good programming practices (comments, naming conventions, program structure, etc)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started