Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Answer clearly and in details #JAVA image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions