Question: Create an array ( of a user - defined size ) Populate the array with Random numbers in the range of 1 - 1 0

Create an array (of a user-defined size)
Populate the array with Random numbers in the range of 1-100, inclusive
Output the original array twice.
SPECIFICATIONS:
The starter code has been provided for this lab.
File name: Arrayoutputvalues.java
The starter code does contain questions at the bottom that must be addressed
The starter code does contain formatting mistakes (including outside the method that students must add code) that must be addressed
The output must match the sample output exactly.
The user must be prompted for
a seed for the random number generator (RNG) and
the size of the array.
Any integer may be used as the seed to the random number generator
An array must be effectively used to accomplish the goal of the assignment (to print twice a single array filled with random numbers), otherwise, full credit will be deducted
Class/Instance variables/constants may not be used. In general, content not formally presented in the class heretofore cannot be usedi
To receive full credit,
The constant called MAX must be declared atop the main() method and effectively used in the program to generate random numbers from 1 to 100, inclusive. In general, avoid using 'magic numbers' in code because 'magic numbers' reduce code-readability. An integer constantivariable should not appear in the code except for possibly common integers, such as 0 or 1.
the main() method must call the following three programmer-defined methods (methods that you write)
an input non-void method that uses a Scanner object (declared in the main) method) but does not declare any variables within the method to return a Random object (that will be used to create random integers in a different method),
a process non-void method that uses a Scanner object, a Random object, and a constant (declared and instantiated in the main() method) to return an array of random integers from 1 to 1002 inclusive, and
an output void method that uses an array of random integers to display program results (the contents of the array printed twice).
the main() method should only contain
the Scanner object and a primitive variable (used to store the number of integers to store in the array) declaration
the three method calls to the programmer-defined methods (the methods that you write), and
one method call to the Scanner object (that does not read from the input bufferl).
use the most appropriate loop to the array manipulation.
the only Scanner object must be declared in the main() method; do not move the Scanner object declaration nor declare another Scanner object in the program.
the program must contain multiple programmer-defined methods (the methods that you write), that complete the major steps of the program, each method should be focused on a singular task, and have a comment that gives a description of the method purpose
every method should be preceded with a comment that includes a description of the method purpose and the value returned (ff applicable)! Comments should also be included in the body of each method.
The program must properly function with any non-negative array size (including a size of 0).
The code should be written efficiently to
Create an array ( of a user - defined size )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!