noel222
01-25-2012, 01:07 AM
I am having great difficulty implementing an arraylist in my code. I am trying to add four values that should be in my arraylist and then return that value. I can't even try to compile my code though, as there are too many errors. Can somebody please help me, I am really lost.
import java.util.ArrayList;
public class Team {
public void T(Earnings teammate) {
ArrayList teammate = new ArrayList();
teammate.add(0,"chris");
teammate.add(1,"steve");
teammate.add(2,"mark");
teammate.add(3,"tom");
}
public double totalGoals() {
ArrayList Employee = new ArrayList();
double sum = 0;
for(int i = 0; i < teammate.size(); i++){
Object F = teammate.get(i);
goal E = (goal) F;
sum += team(i);
}
return sum;
}
import java.util.ArrayList;
public class Team {
public void T(Earnings teammate) {
ArrayList teammate = new ArrayList();
teammate.add(0,"chris");
teammate.add(1,"steve");
teammate.add(2,"mark");
teammate.add(3,"tom");
}
public double totalGoals() {
ArrayList Employee = new ArrayList();
double sum = 0;
for(int i = 0; i < teammate.size(); i++){
Object F = teammate.get(i);
goal E = (goal) F;
sum += team(i);
}
return sum;
}