MUST FULFILL ALL METHODS:FillRandomNum, printArray, computeAver, foldArray, main
ID: 3912022 • Letter: M
Question
MUST FULFILL ALL METHODS:FillRandomNum, printArray, computeAver, foldArray, main meth
Complete the following program by implementing the given methods:
public class LabExam { int[] = new int[10];
//Generate an array of 10 random integers with values in the range 10 to 50 (inclusive)
// public static void fillWithRandomNumbers(int[] list)
// fills the array list with random integers
fillWithRandomNumbers(list);
//Print "list" array ( 5 values per line separated by blank space)
//public static void printArray(int[] list)
// prints the values in the array list printArray(list);
// Compute and print the average
//public static double computeAverage(int[] list) // computes and return the average System.out.println("Average is: " + computeAverage(list));
// Cut the "list" array in half by folding and adding the corresponding values in the array
// public static int[] foldArray(int[] list) // fold and return the new array
int[] newList = foldArray(list);
// Print "newList" array ( 5 values per line separated by blank space)
printArrray(newList); }
Explanation / Answer
public class LabExam { public static void fillWithRandomNumbers(int[] list) { for (int i = 0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.