lete method to create an array of random integers. Method Specification The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter. The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules: The lower bound is always inclusive. If the boolean parameter is true, the up

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Java:

Write a complete method to create an array of random integers.

Method Specification

The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter.

The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules:

  • The lower bound is always inclusive.
  • If the boolean parameter is true, the upper bound is also inclusive.
  • If the boolean parameter is false, the upper bound is not inclusive (meaning it is exclusive).

If any of the parameters are invalid, null is returned.

Driver/Tester Program

I have provided you with a driver/tester program that you can use to test your code before submitting. Paste your code into the placeholder at the top of the file. Review the Homework FAQ page, which contains instructions and a video of how to use the provided file. If you aren't sure how to use the tester or have any questions, post to the discussion board!

strongly recommend running this program before you submit your homework. The program is designed to help you catch common errors and fix them before submitting. Run the program multiple times since random number selection is involved. Each time, review the output to see if your actual results match what was expected. A "**********TEST FAILED" message should also print if a test case fails.

The driver program has some tester methods at the end. These method are used to streamline the running of multiple repeated tests. You don't need to understand, review, or modify these methods.

 

Driver program:

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT