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

How would i do this Java program? The program should fill a 5 X 5 2 dimensional

ID: 656359 • Letter: H

Question

How would i do this Java program?

The program should fill a 5 X 5 2 dimensional array with random numbers within a range selected by the user. The user should be prompted for the lower and upper bound of the random numbers, these values should be passed into the method. The program should then determine and print the largest and smallest values within the array using two Methods Largest and Smallest.   The program should then determine and print the number of values within the array that are divisible by a number entered by the user using a method called DivisibleBy. The program should also enter a loop that will only terminate when the user inputs a -1 as a choice. The loop should continue to ask the user to guess a number that was randomly generated. The program should call the Findit method to determine if the number was in the array. The program should print out the values in the array when the user selects a -1 and then terminate the program.

The Method headers for the program are:

public static void fillit( int [ ][ ] numbers, int lower, int upper )     The method will take the two dimensional array, the lower bound and the upper bound of the random numbers as a parameters. The method will fill the array with random numbers between lower and upper. The method should check to make sure the range is proper between lower and upper.

public static int Largest( int [ ][ ] numbers )     The method will take the two dimensional array as a parameter and the return value is the largest value in the array.

public static int Smallest(int [ ][ ] numbers )     The method will take the two dimensional array as a parameter and the return value is the smallest value in the array.

public static int DivisibleBy(int [ ][ ] numbers, int number )     The method will take the two dimensional array and a number as parameters. The method should determine how many numbers within the array are divisible by the number. The methods should return the count.

public static boolean Findit(int [ ][ ] numbers, int guess )     The method will take the two dimensional array as a parameter and the users guess. The return value is either a true or a false. True means that the number was present and false means it was not found.

public static void PrintThem( int [ ][ ] numbers ) The method should be used to print out the values in the array.

Explanation / Answer

import java.util.Random; public class sparse{ static int matrix [][] = new int[6][6]; public static int randomGen(){ int rA; Random r = new Random(); rA = r.nextInt(100); return rA; } public static int[][] matrixGen(){ for(int i=0; matrix[i].length
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