Question: Finish coding the following code sure with fully commented-pseudocode throughout program. Output should look something like this(use 6-10 strings): Original order: David Abe Katherine Beth

Finish coding the following code sure with fully commented-pseudocode throughout program.

Output should look something like this(use 6-10 strings):

Original order: David Abe Katherine Beth Jeff Daisy Sorted order: Abe Beth Daisy David Jeff Katherine

/** The ObjectSelectionSorter class provides a public static method for performing a selection sort on an array of objects that implement the Comparable interface. */

public class ObjectSelectionSorter {

/** The selectionSort method performs a selection sort on an array of objects that implement the Comparable interface. @param array The array to sort. */

public static void selectionSort(Comparable[] array) { int startScan; // Starting position of the scan int index; // To hold a subscript value int minIndex; // Element with smallest value in the scan Comparable minValue; // The smallest value found in the scan

// The outer loop iterates once for each element in the // array. The startScan variable marks the position where // the scan should begin. // Assume the first element in the scannable area // is the smallest value. // Scan the array, starting at the 2nd element in // the scannable area. We are looking for the smallest // value in the scannable area. for(index = startScan + 1; index < array.length; index++) { { } }

// Swap the element with the smallest value // with the first element in the scannable area. } } }

/** This program tests the selectionSort method in the ObjectSelectionSorter class. */

public class ObjectSelectionSortTest

public static void main(String[] args) // Create a String array with test values. // Note that String implements Comparable. // Display the array's contents. // Sort the array. // Display the array's contents.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!