Menu

[solved]-Write Java Program Single Dimension Array Holds 11 Integer Numbers Sort Array Using Bubble Q39030669

Write a Java program with a single-dimension array that holds 11integer numbers and sort the array using a bubble sort. Next,identify the median value of the 11 integers. Here are the stepsyour program must accomplish.

Step 1. Create the pseudocode that you will use to write theprogram. Place the algorithm in a Word document.

Step 2. Code the program in Eclipse and ensure the followingsteps are accomplished. 1.  Generate 11 random integernumbers between 1 and 100, and place each random number in adifferent element of a single-dimension array starting with thefirst number generated. 2.  Display the array’s contentsin the order the numbers are initially inserted. This is called anunsorted list. An example is below.

3. Using the bubble sort, now sort the array from smallestinteger to the largest. The bubble sort must be in its own method;it cannot be in the main method. Here is the code for the bubblesort method. Use this code, and not some code you find online.Bubble Sort Code: public static void bubbleSort(int[] list) { inttemp; for (int i = list.length – 1; i > 0; i–) { for (int j =0; j < i; j++) { if (list[j] > list[j + 1]) { temp = list[j];list[j] = list[j + 1]; list[j + 1] = temp; } } } }

4. Display the array’s contents after the bubble sort iscompleted. An example is below. 5. Locate the median of the 11numbers. The formula for finding the position of the median in alist of sorted numbers is: ([the number of data points] + 1) ÷ 2.In this case, 11 is the number of data points. You must useimplement this formula to locate the cell in the array thatcontains the median and not just display the item at location 6 ofthe array.

Expert Answer


Answer to Write a Java program with a single-dimension array that holds 11 integer numbers and sort the array using a bubble sort…. . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *