Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Fill an array with ten random integers between 1 and 30 (inclusive, meaning you

ID: 3733988 • Letter: F

Question

Fill an array with ten random integers between 1 and 30 (inclusive, meaning you should be able to have 1 and 30). Write the method printArray which outputs the numbers so you can see what they were. Also write the methods findLargest and findSmallest.

import java.util.Random;


public class L12Num1 {

public static void main(String[] args) {
int[] myArray = new int[10];
  
Random randGen = new Random(); // New random number generator
//fill the array
  
  
//output the array
System.out.println("The contents of the array are: ");
printArray(myArray);

int largest = findLargest(myArray);
int smallest = findSmallest(myArray);

System.out.println("The largest element in the array is " + largest);
System.out.println("The smallest element in the array is " + smallest);
  
  
}
public static void printArray(int[]A)
{
  
  
}
public static int findLargest(int[] A)
{
  
  
}
public static int findSmallest(int[] A)
{
  
}
  
}

Explanation / Answer

import java.util.Random; public class L12Num1 { public static void main(String[] args) { int[] myArray = new int[10]; //Random randGen = new Random(); // New random number generator int min = 10, max = 100; int range = (max - min) + 1; //fill the array for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote