Finishing up penny pitch program
<p>1 1 1 1 1</p>

<p>1 2 2 2 1</p>

<p>1 2 3 2 1</p>

<p>1 2 2 2 1 </p>

<p>1 1 1 1 1</p>

<p>^^this is what the board looks like</p>

<p>Directions:
a player tosses several pennies on the board aiming for the number with the highest value. At the end of the game, the total of the tosses is returned. Develop a program that plays this game. The program should perform the following steps each time the user selects the TOSS button: Generate 2 random numbers for the row and column toss. Add the number at this position to a running total. Display the board, replacing the numbers with P's where the pennies land.</p>

<p>Should use a 2D array of square objects. Each square contains a number like those above (board) and a boolean flag that indicates a penny has landed on a square.</p>

<p>here is what I have so far</p>

<pre><code>import java.util.Random; 

 public class PennyPitch {

 public static void main(String[] args) {

 Square[][] table = new Square [5][5];

 for (int r = 0;r &lt; 5; r++){

  for (int c = 0; c &lt; 5; c++){

    table[r][c] = new Square();
  }
 }
 for(int c = 0; c &lt;5; c++){

 table[0][c].setScore(1);
}
for(int c =0; c&lt;5; c++){

 table[3][c].setScore(1);
}
for(int c =0; c&lt;5; c++){
 table[1][c].setScore(1);
}
for(int c =0; c&lt;5; c++){

 table[2][c].setScore(1);
}
for(int c =0; c&lt;5; c++){

 table[4][c].setScore(1);
}

   table[1][1].setScore(2);

   table[1][2].setScore(2);


   table[1][3].setScore(2);

   table[2][1].setScore(2);

   table[2][2].setScore(3);

   table[2][3].setScore(2);

   table[3][1].setScore(2);

   table[3][2].setScore(2);

   table[3][3].setScore(2);


  for(int r=0; r&lt;5; r++){

   for(int c = 0; c&lt;5; c++){

   System.out.print(table[r][c].getScore());

   }
   System.out.println();
    }
    int sum;

 int c = (int)((Math.random()*5)+1);
 int r = (int)((Math.random()*5)+1); 
 for (int rounds = 0;rounds &lt; 5; rounds++){
     sum += table[c][r];   
     table[r][c].setScore("P");
     }
 for(int r=0; r&lt;5; r++){
     for(int c=0; c&lt;5; c++){
         System.out.println(table[r][c].getScore());
    }
     System.out.println();
     }
     }
        }
</code></pre>

<p>Square class
                 public boolean yes;
           public int score;</p>

<pre><code>public Square(){
    score = 0;
    yes = false;
}
public void setScore(int s ){
    score = s;
}
public void setyes(boolean y){
    y =yes;
}
public int getScore(){
    return score;
    }
public boolean getYes(){
    return yes;
}
   }
</code></pre>

<p>I just need help with changing the positions on the board to P's and adding up the score. Thanks in advance!</p>
