Alright, so basically I have this program going, it reads the text file perfectly, I also have some arrays created. Now I need it to store each team's rebounds, assists, and points separately. From there I need to get the mean, median, mode for each section (which will be completed after). The part which I'm stuck at is storing each team's specific rebounds, assists and points into the specified arrays.
Here is what the text file contains:
Player Team Points Rebounds Assists
Garnett-Kevin (Boston-Celtics) 23 15 3
Rondo-Rajon (Boston-Celtics) 6 51 6
Dooling-Keyon (Boston-Celtics) 54 23 7
Bass-Brandon (Boston-Celtics) 74 23 5
Allen-Ray (Boston-Celtics) 9 90 107
Johnson-Amir (Toronto-Raptors) 51 12 65
Bayless-Jerryd (Toronto-Raptors) 20 26 14
Bargnani-Andrea (Toronto-Raptors) 43 18 17
Calderon-Jose (Toronto-Raptors) 32 19 19
DeRozan-DeMar (Toronto-Raptors) 17 16 14
What I am thinking of doing is:
public static void main(String[] args) {
int[] tDotPoints = new int[10];
int [] tDotRebounds = new int[10];
int [] tDotAssists = new int[10]; //arrays to hold the scores for each catergory of each player
int [] bostonPoints = new int [10];
int [] bostonRebounds = new int [10];
int [] bostonAssists = new int [10];
for (counter = 0; scan.hasNextInt; counter++){ //need to have it scan integers as they appear
if (counter % 3 = 0){ //for the points
add to this array using a method
}
if (coutner % 3 = 1){ //for the rebounds
add to that array using a a method
}
if (counter % 3 = 2){ //for the assists
add to that array using a method
}
I didn't post the code for reading the file, because that is already completed. However, I have posted what I think needs to be completed, and also the created arrays. I know it's a bit incorrect, but if someone can elaborate on how I can accurately complete this, then that would be greatly appreciated. Thanks!