Question: Answer clearly and in details #JAVA Write the Lottery program so that it asks the user to enter a series of 5 numbers in the
Write the Lottery program so that it asks the user to enter a series of 5 numbers in the range of 0 through 9 for each element in the array. After the user enters the numbers, the program compares them to 5 numbers that it randomly generated and prints out the how many numbers matched and the matching numbers. The program has to be written according to these rules: The user submitted numbers will be stored in an array. The randomly generated lottery numbers will be stored in an array. The two arrays will be compared to each other to find out the matching numbers. If the user matches all five numbers, the program should print that the user won the lottery. The program will be written in a modular way, meaning that: The user values will be received through a getValues method. The comparison will be also made by a compareNumbers method. This method will receive both the lottery numbers array and the user array and will return the matching numbers. You can have repeating numbers in the lottery. Sample output: Enter a series of 5 numbers. Enter number 1: 3 Enter number 2: 4 Enter number 3: 5 Enter number 4: 1 Enter number 5: 2 The lottery numbers are: 7 4 3 4 0 You matched 1 numbers The matching numbers are: 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
