Question: Solve in Java please Question 1. 1.1 Write a public static void Initialization(int[] intArray, int N) This method will initialize an intArray with N random

Solve in Java please

Question 1.

1.1 Write a public static void Initialization(int[] intArray, int N)

This method will initialize an intArray with N random integers using for-loop. The random number has a range of (1-20).

1.2 Write a public static void Print(int[] intArray)

This method will take one input: the intArray. It will use a for-loop to print out all elements in this intArray.

1.3 Write a method: public static int Search(int[] intArray, int targetInt)

This method will take two inputs: the intArray, and the targetInt. It will use a for-loop to go through the intArray; then return the index of the first matched intArray element that equals to targetInt. If there is no matched element found, return -1.

1.4 Write a method: public static void BubbleSort(int[] intArray)

This method will take one input: the intArray. It will use a nested for-loop to sort the int array.

1.5 In your main function:

  1. Please declare an empty array with N elements;
  2. Please call the initialization function to initialize this array with N elements
  3. Please call the Print function to print out all N elements
  4. Please call the Search function to find the index of numer 10; then print out the index
  5. Please call the Bubble sort function to sort the array
  6. Please print out the sorted array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!