Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Problem 2 (name this Lab8 Problem2) This program will generate and display a designated set of random numbers within the range provided by the

Java image text in transcribed
Problem 2 (name this Lab8 Problem2) This program will generate and display a designated set of random numbers within the range provided by the end user Main: The main method will call the methods below in sequence, as long as the user chooses to not quit. A nested if block is an appropriate way to examine the return value from each program in order to determine whether or not to go on to the next part. There is no input or output in mainJust use it as a "conductor" to orchestrate calling the remaining methods. Method 1: Ask the user how many random integers to generate; allowable values are 1 to 200, or 0 to quit. Anything else is an error. message, then re-prompt until either a good value is entered or 0. Return the integer value. isplay an error Method 2: Ask the user the minimum integer value for the random number, it can be anything from 0 or higher, as long as it's an integer. Continue to prompt until you get a valid value, then return that value to main. If the user types in a negative value, it means they give up. Stop nagging, and return the negative value to main) Method 3: Same thing as method 2, but code this to obtain the maximum random number you want. Again, return a negative value if they give up. Method 4: Pass this method three arguments, and return nothing. The arguments are to indicate, in this order: how many random numbers to create; the lowest acceptable value; and the highest acceptable value. The method must then generate the random numbers, and display them, one value per line of output. Sample dialog to use in coding your solution: How many random integers do you want? (1 to 200, or 0 to quit) 0 User quits. Program re-runs: How many random integers do you want? (1 to 200, or 0 to quit) 10 Minimum acceptable value, inclusive: -1 Goodbye User quits. Program re-runs: How many random integers do you want? (1 to 200, or 0 to quit) 15 Minimum acceptable value, inclusive: 0 Maximum acceptable value, inclusive: 10 Here are your 15 random numbers from 0 to 10

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago