Question: in JAVA...... 1- remove comma from the end of the array. 2- Next, use a loop to help determine and then print the average of
in JAVA......
1- remove comma from the end of the array.
2- Next, use a loop to help determine and then print the average of all of the numbers. in a JOptionPane dialog window ( no scanners / system.out.print )
3- Next, print a list of all the numbers that are greater than the average.
4- Next, print a list of the number that are divisible by 3.
import javax.swing.*; import java.util.Random;
public class arraytest {
public static void main(String[] args) {
int [] array = new int[ 20 ]; Random r = new Random(); String msg = "Array is... "; for( int i = 0; i < array.length; i++ ) { array[i] = r.nextInt(100) + 1; msg += array[i] + ", "; } JOptionPane.showMessageDialog(null, msg );
} // end main
} // end class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
