Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE EXPLAIN THE STEPS. It does nothing for me if you just to do it. I need to have understanding of what is going on

PLEASE EXPLAIN THE STEPS. It does nothing for me if you just to do it. I need to have understanding of what is going on so I can replicate. In Java, generate 5 random numbers (known as lotto numbers) and a powerball. Write a method to make sure that none of the first five numbers is repeated more than once (e.g., first five numbers are unique). The generated numbers fall in the range between 1 and n. The value of n is between 23 and 100. N is determined by the user input. Then generate a separate number known as the power ball. The power ball is always between 1 and 40. This number is generated independently of the other five and is NOT required to be unique from them. Use an array or ArrayList to store the numbers when checking for duplicates. Use enhanced for loop to print the array elements. Each method in this program must be specialized and does very specific work (has a high level of cohesion and very reusable). You must have a separate class of the data structure and related methods- set, get, constructor, numbers 1..5, and power ball, and method to generate the random numbers. And another class that has the the main method. code should not terminate until the user indicates so. Your program will generate the numbers then will ask the user: For example: Press 0 (zero) to exit or any key if you want to generate another set of numbers The user enters the upper value of the range of numbers to be generated by the random number generator between 23 and 100.

For example of input and output:

What is the upper range of values you want to use for Random numbers): valid value is between 23 and 100 (e.g, enter 54 to generate numbers between 1 and 54?

56.

The Easy Pick Randomly Generated Numbers Are: 2 18 21 50 23 and the Powerball is 18

Do you want to play again (Enter Y for yes or, N-no)?

N

Good bye

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

Step: 3

blur-text-image

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

What is human nature?

Answered: 1 week ago