I am stuck on a java programming assignment for my first-semester java programming course. I was given a code for a method which sorts an array of numbers by finding the smallest number and swapping it with the first number in the array. (I've put the given code in below). I am supposed to rewrite it to find the largest number and swap it wth the last number in the array, and write a test program that reads in ten double numbers, invokes the method, and displays the sorted numbers.

I tried to rewrite the code and I'm not sure whether what I did will work (I may have only gotten it to swap the largest number in the array with the first number, rather than the last). But I'm mostly having trouble with writing the program around it. The way I've got it right now, when I try to compile the .java file, I'm getting 9 errors that all say "cannot find symbol" for different places all through the code. (The program isn't completely written yet either, because I haven't put in the part that will print the sorted array. I wanted to get the part I have done working before I make the program more complicated.)

Here is the code I was given:

Code:

public class SelectionSort {
public static void selectionSort(double[] list) {
for (int i = 0; i < list.length - 1; i++) {
//find the minimum in the list
double currentMin = list[i];
int currentMinIndex = i;
for (int j = i + 1; j < list.length; j++)) {
if (currentMin > list[j] {
currentMin = list[j];
currentMinIndex = j;
}
}
//swap list[i] with list[currentMinIndex] if necessary
if (currentMinIndex != i) {
list[currentMinIndex] = list[i];
list[i] = currentMin;
}
}
}
}

And here is my program's code:

Code:

import java.util.Scanner;
public class Exercise6_17 {
public static void main(String[] args) {
double[] list = new double[10];
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.print("Enter " + list.length + " values: ");
for (int i = 0; i < list.length; i++)
list[i] = input.nextDouble();
selectionSort(list);
}
public static void selectionSort() {
for (int i = 0; i < list.length - 1; i++) {
//find the maximum in the list[i...list.length-1]
double currentMax = list[i];
int currentMaxIndex = i;
for (int j = i + 1; j < list.length; j++) {
if (currentMax < list[j]) {
currentMax = list[j];
currentMaxIndex = j;
}
}
//Swap list[i] with list [currentMaxIndex] if necessary
if (currentMaxIndex != i) {
list[currentMaxIndex] = list[i];
list[i] = currentMax;
}
}
}
}

Can you guys help?