Q:

Getting Golf scores into an array

Hey guys I'm trying make a program that simulates a scorecard in Golf. I'm stuck with the arrays... 
I have a hole[] {0, 1, .... ,17} to counts a 18 hole course. But for each element in the array I think I'm going to need another array that takes the user's score for that hole.
I need help with incrementing the hole score( h1S, h2S, h3S...) because right now h1S is going to be reused for every hole so it's just going to rewrite itself right? lol anyways I'm lost, help me please.
static int hole[] = new int[18];
{

hole[0] = h1S; // hole Scores..
hole[1] = h2S;
hole[2] = h3S;
hole[3] = h4S;
hole[4] = h5S;
hole[5] = h6S;
hole[6] = h7S;
hole[7] = h8S;
hole[8] = h9S;
hole[9] = h10S;
hole[10] = h11S;
hole[11] = h12S;
hole[12] = h13S;
hole[13] = h14S;
hole[14] = h15S;
hole[15] = h16S;
hole[16] = h17S;
hole[17] = h18S;

}

public static void test1() 
{
    Scanner input = new Scanner(System.in);

    if (numPlayers == 1)
    {
        for (int holeNumber = 1; holeNumber < 19; holeNumber++)
        {
            System.out.println(player1 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();// i need increment h1S somehow *******************
        }
    }

    else if (numPlayers == 2)
    {
        for (int holeNumber = 1; holeNumber < 19; holeNumber++)
        {
            System.out.println(player1 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player2 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();
        }
    }

    else if (numPlayers == 3)
    {
        for (int holeNumber = 1; holeNumber < 19; holeNumber++)
        {
            System.out.println(player1 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player2 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player3 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();
        }
    }

    else if (numPlayers == 4) 
    {
        for (int holeNumber = 1; holeNumber < 19; holeNumber++)
        {
            System.out.println(player1 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player2 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player3 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();

            System.out.println(player4 + ", Enter your hole " + holeNumber + " score.");
            h1S = input.nextInt();
        }
    }

}// end test1

Thanks guys.

A:

you do need a 2D array (if you want to keep score with arrays) but you could generate it programatically
int[][] score;

public Scorecard(int players){
  score = new int[18][players];
}

Then, to keep score, simply record score[hole][playernum] = score
Envision it as a grid with the x axis being the hole and y being the player. This method also allows you to record at each stroke, since you could increment it with score[hole][playernum]++

