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:
- Please declare an empty array with N elements;
- Please call the initialization function to initialize this array with N elements
- Please call the Print function to print out all N elements
- Please call the Search function to find the index of numer 10; then print out the index
- Please call the Bubble sort function to sort the array
- Please print out the sorted array
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started