I wanted to -Implement a class named RandNum. The class should have a 5x5 2D array of 25 integers. - The constructor should use the random() function to generate a random number in the range of 1 to 100 for each element in the array.
-
Implement a method to calculate the minimum, maximum and average of the 25 values.
-
Implement a method to display the values of the array, minimum, maximum and average of the 25 values.
public class RandNum {
private int[][] random=new int [5][5] ;
public void random() {
random=new int[5][5];
for(int i=0;i<100;i++) {
random[i]=(int[][])(Math.random()*25);
} // TODO Auto-generated constructor stub
}
public void calculate(){
}
public void display() {
Aucun commentaire:
Enregistrer un commentaire