I am unable to compile this code. I am trying to sort by author with the code. The error message says it is looking for a symbol for inventorySort which is the class that I created to do the sort. Any help would be appreciated.
Thanks in advance
//The main driver class for the Bookstore Inventory
Where in this class do you create inventorySort. I was looking for something like InventorySort inventorySort = new InventorySort();
or
is selectionSort(inventory) a static method in the InventorySort class? In that case I'd guess that you need to be more aware of Java's case sensitivity.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Monic Sherm
Greenhorn
Joined: Sep 30, 2005
Posts: 13
posted
0
This is the inventorySort class that I created. Any advice would be greatly appreciated
public class inventorySort {
//----------------------------------------------------------------- // Sorts the specified array of objects using the selection // sort algorithm. //----------------------------------------------------------------- public static void selectionSort (Comparable[] list) { int min; Comparable temp;
for (int index = 0; index < list.length-1; index++) { min = index; for (int scan = index+1; scan < list.length; scan++) if (list[scan].compareTo(list[min]) < 0) min = scan;