Java program
Write a Java program which defines unconstrained array of user defined length n (the value of n is to be taken from a proper user’s input). Fill in the array with n random numbers. The application should (1) display all elements of the array, (2) display the sum of all elements, and (3) calculate the average of all elements. Thus far I have: /*============================================================================= |Assignment: Array.java |Programmer: April Driesse /[email protected] | |Course: Data Structures / ITEC-2010-2 |Instructor: Professor Vladimir Gubanov |Due Date: 1/22/2015 | |Language: Java | +—————————————————————————– *=========================================================================*/ import java.util.Random; import java.io.Console; public class arrayn { public static void main( String[] args ) { int arrayLength; // used to hold length of the array we want to create int[] arrayOfInts; // our unconstrained array Console console = System.console(); Random rnums = new Random(); System.out.println(“Arrays Are Interesting to Learn”); // get size of array from user arrayLength = Integer.parseInt(console.readLine(“Enter size of array: “)); arrayOfInts = new int[arrayLength]; // creates the array of the size // entered by the user // populate array with random numbers for (int iLoop = 0; iLoop
