im having some trouble with another program (im just not good with modules and arrays really). can anyone help me to get it working correctly? been working on it all night and im extremely tired... anyway here is the code ive done so far. the problem asks: 

> 
> Design a program that asks the user to enter 10 golf scores. The
>  scores should be stored in an Integer array. Sort the array in
>  ascending order and display its contents.
> 
> 
> 

```
import java.util.Scanner;

public class SortedGolfScoresIB
{
    public static void main(String[] args)
    {
        //local variables
        final int SIZE = 10;
        int[] scores = new int[SIZE];

        // get the scores
        getScores(scores, SIZE);

        // sore the scores in ascending order
        insertionSort(scores, SIZE);

        //display the results in ascending order
        displayScores(scores, SIZE);
    }

    // the getScoresmodule prompts the user for
    // golf scores to populare the scores array.

    public static void getScores(int scores[], int size)
    {
        // local variable for loop index
        int index;

        // get the scores
        for (index = 0; index <=size; size--)
        {
            System.out.println("Enter golf score number " + index +1 + ":");
            Scanner keyboard = new Scanner(System.in);
            scores[index] = keyboard.nextInt();
        }

        }
        // the insertionSort module sorts the contents of the  array
        // in ascending order
        public static void insertionSort(int  array[], int size)
        {
            //local variables
            int index;
            int scan;
            int unsortedValue;

            for (index = 1; index <=size; size--)
            {
                unsortedValue = array[index];
                scan = index;
            }

            while (scan > 0 && array[scan-1] < array [scan])
            {
                swap (array[scan-1], array[scan]);
                scan = scan -1;
            }

        array[scan] = unsortedValue;
        }

        //the swap module swaps the contents of its two arguments
        public static void swap(int a, int b)
        {
            int temp;
            //swap a and b
            temp = a;
            a = b;
            b = temp;
        }

        // the display scores module displays the
        // golve scores in the scores array
        public static void displayScores(int scores[], int size)
        {

            // local variable for loop index
            int index;

            //display the scores
            System.out.println ("here are the scores: ");
            for (index=0; index <= size; size--)
            {
                System.out.println(scores[index]);
            }
        }
    }

```

can anyone help me to get this working and error free?

Edit1: i updated the code and here is what i have now

```
import java.util.Scanner;

public class SortedGolfScoresIB
{
    public static void main(String[] args)
    {
        //local variables
        final int SIZE = 10;
        int[] scores = new int[SIZE];

        // get the scores
        getScores(scores, SIZE);

        // sore the scores in ascending order
        insertionSort(scores, SIZE);

        //display the results in ascending order
        displayScores(scores, SIZE);
    }

    // the getScoresmodule prompts the user for
    // golf scores to populare the scores array.

    public static void getScores(int scores[], int size)
    {
        // local variable for loop index
        int index;

        // get the scores
        for (index = 0; index <=size; index++)
        {
            System.out.println("Enter golf score number " + (index +1) + ":");
            Scanner keyboard = new Scanner(System.in);
            scores[index] = keyboard.nextInt();
        }

        }
        // the insertionSort module sorts the contents of the  array
        // in ascending order
        public static void insertionSort(int  array[], int size)
        {
            //local variables
            int index;
            int scan;
            int unsortedValue;

            for (index = 1; index <=size; index++)
            {
                unsortedValue = array[index];
                scan = index;
                array[scan] = unsortedValue;

                }

            while (scan > 0 && array[scan-1] < array [scan])
            {
                swap (array[scan-1], array[scan]);
                scan = scan -1;
            }

        }

        //the swap module swaps the contents of its two arguments
        public static void swap(int a, int b)
        {
            int temp;
            //swap a and b
            temp = a;
            a = b;
            b = temp;
        }

        // the display scores module displays the
        // golve scores in the scores array
        public static void displayScores(int scores[], int size)
        {

            // local variable for loop index
            int index;

            //display the scores
            System.out.println ("here are the scores: ");
            for (index=0; index <= size; index++)
            {
                System.out.print(scores[index]);
            }
        }
    }

```

the error im getting now is that the "scan" in my while loop is not initialized. 

edit 2:

got the program to work and compile correctly, but its not outputting all of the scores at the end in ascending order like it should.

```
import java.util.Scanner;

public class SortedGolfScoresIB
{
    public static void main(String[] args)
    {
        //local variables
        final int SIZE = 10;
        int[] scores = new int[SIZE];

        // get the scores
        getScores(scores, SIZE);

        // sore the scores in ascending order
        insertionSort(scores, SIZE);

        //display the results in ascending order
        displayScores(scores, SIZE);
    }

    // the getScoresmodule prompts the user for
    // golf scores to populare the scores array.

    public static void getScores(int scores[], int size)
    {
        // local variable for loop index
        int index;

        // get the scores
        for (index = 0; index <=size; index++)
        {
            System.out.println("Enter golf score number " + (index +1) + ":");
            Scanner keyboard = new Scanner(System.in);
            scores[index] = keyboard.nextInt();
        }

        }
        // the insertionSort module sorts the contents of the  array
        // in ascending order
        public static void insertionSort(int  array[], int size)
        {
            //local variables
            int index;
            int scan;
            int unsortedValue;

            for (index = 1; index <=size; index++)
            {
                unsortedValue = array[index];
                scan = index;

                array[scan] = unsortedValue;

            while (scan > 0 && array[scan-1] < array [scan])

                swap (array[scan-1], array[scan]);
                scan = scan -1;
            }

        }

        //the swap module swaps the contents of its two arguments
        public static void swap(int a, int b)
        {
            int temp;
            //swap a and b
            temp = a;
            a = b;
            b = temp;
        }

        // the display scores module displays the
        // golve scores in the scores array
        public static void displayScores(int scores[], int size)
        {

            // local variable for loop index
            int index;

            //display the scores
            System.out.println ("here are the scores: ");
            for (index=0; index <= size; index++)
            {
                System.out.print(scores[index]);
            }
        }
    }

```

code compiles and works, but its not outputting the contents of the array. im getting an out of bounds error. 

edit 3: fixed the out of bounds error by changing "index <= size" to "index < size". but error im getting now is that my code just stops after all 10 scores were entered and not displaying the contents of the array as i mentioned before.

```
import java.util.Scanner;

public class SortedGolfScoresIB
{
    public static void main(String[] args)
    {
        //local variables
        final int SIZE = 10;
        int[] scores = new int[SIZE];

        // get the scores
        getScores(scores, SIZE);

        // sore the scores in ascending order
        insertionSort(scores, SIZE);

        //display the results in ascending order
        displayScores(scores, SIZE);
    }

    // the getScoresmodule prompts the user for
    // golf scores to populare the scores array.

    public static void getScores(int scores[], int size)
    {
        // local variable for loop index
        int index;

        // get the scores
        for (index = 0; index <=size; index++)
        {
            System.out.println("Enter golf score number " + (index +1) + ":");
            Scanner keyboard = new Scanner(System.in);
            scores[index] = keyboard.nextInt();
        }

        }
        // the insertionSort module sorts the contents of the  array
        // in ascending order
        public static void insertionSort(int  array[], int size)
        {
            //local variables
            int index;
            int scan;
            int unsortedValue;

            for (index = 1; index <=size; index++)
            {
                unsortedValue = array[index];
                scan = index;

                array[scan] = unsortedValue;

            while (scan > 0 && array[scan-1] < array [scan])

                swap (array[scan-1], array[scan]);
                scan = scan -1;
            }

        }

        //the swap module swaps the contents of its two arguments
        public static void swap(int a, int b)
        {
            int temp;
            //swap a and b
            temp = a;
            a = b;
            b = temp;
        }

        // the display scores module displays the
        // golve scores in the scores array
        public static void displayScores(int scores[], int size)
        {

            // local variable for loop index
            int index;

            //display the scores
            System.out.println ("here are the scores: ");
            for (index=0; index <= size; index++)
            {
                System.out.print(scores[index]);
            }
        }
    }

```

3rd and hopefully last edited code. can anyone help me with this last bit?