Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions