Create a Java application that implements the use of an int array. Use \'for\' l
ID: 3623247 • Letter: C
Question
Create a Java application that implements the use of an int array. Use 'for' loops to iterate through the array using the array’s length variable to stay within the array bounds. Fill the array with random numbers and print the array. The output might look similar to this:--------------------Configuration: <Default>--------------------
The following 10 numbers were chosen at random and loaded into an array:
49
81
6
28
80
68
74
11
45
50
Process completed.
Continue to properly document your source code. Write this program as if you were explaining it to someone new to arrays. Fully document your code in such a way newcomers to Java will understand and be able to implement a Java array. Your grade on this assignment will be based on your thoroughness of documentation as well as you correctness of code.
Explanation / Answer
please rate - thanks
import java.util.*;
public class Main
{public static void main(String[] args)
{int i;
int []a=new int[10];
Random r = new Random();
System.out.println("The following 10 numbers were chosen at random and loaded into an array:");
for(i=0;i<a.length;i++)
a[i]=r.nextInt(100)+1; //generate a random number between 1 and 100
for(i=0;i<a.length;i++)
System.out.println(a[i]);
}
}