C7_Project (2) [Java Application] C:\Program Files\Java'jre1.8.0_131\bin\javaw.exe (Mar 26, 2019, 11:24:20 AM) The largest value is 10e The unsorted list is: 64 The sorted list is: 3 24 24 48 48 71 100 81 3 100 64 71 81 SAMPLE
Write a Java program with a single-dimension array that holds 10 integer numbers and identify the maximum value of the 10 numbers. Next sort the array using a bubble sort and display the array before and after sorting.
Psuedocode
Generate 10 random integer numbers between 1 and 100 place each random number in a different element of a single-dimension array
Display the array's contents unsorted as they are generated
Using the bubble sort, sort the array from smallest integer to the largest.
//must use the following:
Bubble Sort Code:
public static void bubbleSort(int[] list)
{
int temp;
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;
}
}
}
}
Display the array's contents after the bubble sort is completed
![<terminated> C7_Project (2) [Java Application] C:\Program Files\Java'jre1.8.0_131\bin\javaw.exe (Mar 26, 2019, 11:24:20 AM)
The largest value is 10e
The unsorted list is: 64
The sorted list is: 3
24
24
48
48
71
100
81 3
100
64
71
81
SAMPLE](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9f4ea7c7-22da-4de1-aa57-51c0851ab99c%2Fede7c1b6-89ee-42e6-861a-489a90208a55%2Fm2y83p.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images









