...

View Full Version : ArrayList Help



noel222
01-25-2012, 12:19 AM
I am trying to write a program that has 4 teammates. The first part of the code calculated the number of goals scored by each member. I then have to write a new class that puts each teammate in an arraylist and then has a method that calculated the combined number of goals of the 4 teammates. I am very lost and really don't even know where to start. Can someone please help me? Here is what I have so far. I already have a class that calculates the goals of each teammate.




import java.util.ArrayList;

public class team {

public void teammate(goals teammate){

ArrayList teammate = new ArrayList();

}


public double totalGoals() {
ArrayList teammates = new ArrayList();
for(int i = 0; i < teammate.size();i++){

Object t = teammate.get(i);
goals E = (goals) F;
}

return 0;
}

Old Pedant
01-25-2012, 12:53 AM
Wrong forum.

This is the JavaSCRIPT forum.

About the only thing Java and JavaScript have in common are the first 4 letters of their names.

Old Pedant
01-25-2012, 12:55 AM
FWIW, your code makes no sense.


public void teammate(goals teammate){

ArrayList teammate = new ArrayList();

}

You just used the name teammate to refer to THREE different things!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum