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!

why are you using this

if (counter % 3 = 2){ }

i dont get the '% 3' and to be honest this must be the first time ive seen such an if statement

why are you using this

if (counter % 3 = 2){ }

i dont get the '% 3' and to be honest this must be the first time ive seen such an if statement

Haha, you must be new at programming, just like me :)

% is called modular in Java, and is used to get the remainder. For example, 10%3 = 1, this is because 3 goes into 10 three times, and is left with a remainder of one.

Haha, you must be new at programming, just like me :)

% is called modular in Java, and is used to get the remainder. For example, 10%3 = 1, this is because 3 goes into 10 three times, and is left with a remainder of one.

lol no im not that new, but why do you want to use that? its just compilcating stuff?

as you read in the value if its the first value after the teams name then it will be a rebound, if its the 2nd value after the team it will be an assist and so on? why not just use lastindexof(')'); and from there read in the string this should give you only the scores which are seperated by a white space, then split() them according to that white space and what you are left with is 3 values in a String or int array which can then be added to their specific arrays

why are you using this if (counter % 3 = 2){ } i dont get the '% 3' and to be honest this must be the first time ive seen such an if statement

Me too, but not because of the %, but because it's not Java. It won't compile with a Java compiler. You can't assign the value 2 to the integer constant 3.
All together now children, repeat after me:
= is assignment
== is the test for equality

:twisted: J

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.