Professional Documents
Culture Documents
Import
Import
Scanner;
// (a) Declare the global 1D array, PRICE, with ten elements. Populate the array with the given data
above.
static int[] PRICE = {50, 100, 50, 120, 65, 120, 90, 24, 78, 200};
DISPLAY();
// • output an appropriate message to tell the user whether the search value was found or not
if (found) {
} else {
System.out.println("The value " + searchValue + " was not found in the array.");
Bubblesort();
DISPLAY();
}
// (b) Write a procedure called DISPLAY to output all the elements in the array.
System.out.println("Array elements:");
System.out.println();
// search on array PRICE to find the parameter value. It returns True if it was found and
if (PRICE[i] == value) {
return true;
return false;
int n = PRICE.length;
// Swap elements
PRICE[j + 1] = temp;