import java.util.Scanner;
import java.util.Random;
public class Lab7a {
public static void main (String[] args){
Scanner scnr = new Scanner(System.in);
Random rand = new Random(107L);
int numInputs = scnr.nextInt();
/* FIXME print numInputs here */
/* FIXME declare double array called numbers and assign to it the array returned from initArray(numInputs, rand) call. */
/* FIXME Write a statement that calls getStats passing numbers as the parameter */
/* FIXME Write a statement that calls print method passing numbers as the parameter */
}
/* FIXME Write initArray method HEADER and BODY with a print statement and return an array here */
/* FIXME Write getStats method HEADER and BODY with variable declarations and print statements here. */
/* FIXME Write the print method HEADER and BODY with only a print statement here */
}
}
Task In the process of developing a program, we often layout the general design before coding the details. In this lab you will only write an outline of your program. It should compile without errors but it won\'t yet do anything useful. The useful part we will do in Lab7b So why do this? You may have found by now that jumping in and writing a program before you thought through what has to happen, in what order, and how often leads to re-writing and/or mass confusion. As you learn to code, learn the discipline of planning. The purpose of this lab is to practice \"step one\", that is, the planning stage by outlining a program and its methods. You will only define variables, method calls, and method headers. The body of the methods will have print statements that are just placeholders to show the flow of the program In the window below are several FIXME comments. They describe what to do. For example, if the statement indicates calls myMethod passing quakes as a parameter then you know that portion will look something like myMethod(quakes); Recall that method calls come in two forms: those that are a statement in and of themselves, and those that return something that will be assigned to a variable Here is the class outline structure: maln declares numlnputs and reads in a value from the user prints \"numlnputs is n here n is the user input calls the three methods below initArray prints \"Using a random number generator to initialize array with n elements\", where n is the int value passed into init prints \"Returning array\" get Stats prints \"In getStats\" declares variable for the min, ma average and range then prints out their initial values. print prints \"In print Sample output When input is The output exactly matches when input is 5 num Inputs is 5 Using a random number generator to initialize array with 5 elements Returning array In get Stats Maximum 0.0 Minimum 0.0 Average 0.0 Range 0 In print
Please find the required program along with its output. Please see the comments against each line to understand the step.
------------------------------------------------------------------------
OUTPUT:
5
numInputs is 5
Using a random number generator to initialize array with 5 elements
Returning array
In getStats
Maximum: 0.0
Minimum: 0.0
Average: 0.0
Range: 0
In print