public class Arrays
{
int[] arrayOfTenIntegers = new int[10];
Point[] arrayOfTenPoints = new Point[5];
int[] xc = {12,321,54,12,53};
int[] yc = {32,38,21,31,123};
public void initInts(){
for(int x=0;x<10;x++){
arrayOfTenIntegers[x] = x+1;
}
}
public void initPoints(){
for(int x=0;x<5;x++){
Point p = new Point(xc[x],yc[x]);
arrayOfTenPoints[x] = p;
}
}
public double getTotalDistance(){
double distance = 0;
for(int x=0;x<4;x++){
distance = distance +
arrayOfTenPoints[x].distanceTo(arrayOfTenPoints[x+1]);
}
return distance;
}
}
Arrays
Labels:
compsci
Kelangan ko na magconsult, I swear. XD
Post a Comment
Hi. :-h