[Solved] Far Package Javaapplication38 Import Javaxswing Import Javautilrandom Import Javautilscann Q37191271
So This is what I have so far:
package javaapplication38;
import javax.swing.*;
import java.util.Random;
import java.util.Scanner;
public class JavaApplication38
{
public int[][] createArray(int rSize, int cSize)
{
Random r = new Random();
int[][] array = new int[rSize][cSize];
for(int row = 0; row < array.length; row++)
{
for(int col = 0; col < array[0].length; col++)
{
array[row][col] = r.nextInt(100); <——— NEED HELP MAKINGTHIS only numbers between 1-25***
}
}
return array;
}
public void print2DArray(int[][] array)
{
for(int row = 0; row < array.length; row++)
{
for(int col = 0; col < array[0].length; col++)
{
System.out.println(array[row][col] + “t”);
}
System.out.println(“n”);
}
}
public int countInstance(int[][] array, int search)
{
int count = 0;
for(int row = 0; row < array.length; row++)
{
for(int col = 0; col < array[0].length; col++)
{
if(array[row][col] == search)
count++;
}
}
return count;
}
public static void main(String[] args)
{
int[][] myArray;
Scanner in = new Scanner(System.in);
JavaApplication38 c = new JavaApplication38();
myArray = c.createArray(10, 10);
c.print2DArray(myArray);
int value;
System.out.println(“Enter a number to search for”);
value = in.nextInt();
System.out.println(“Your number occurred ” +c.countInstance(myArray, value)
+ “times”);
}
}
WHAT I NEED HELP WITH: So for CountInstance, I need it to notonly count but to output where they’re located.
Expert Answer
Answer to So This is what I have so far: package javaapplication38; import javax.swing.*; import java.util.Random; import java.uti… . . .
OR

