The animals talk: Parallel Arrays
One array contains animals, the other the things they say
The animals talk: Parallel Arrays
One array contains animals, the other the things they say
Download the Alice project: animals-talk.a3p
public void myFirstMethod() {
SJointedModel[] animals = new SJointedModel[] {
this.cow, this.pig, this.billyGoat, this.chicken
}
;
String[] sayings = new String[] {
"moo", "oink", "maa", "cluck"
}
;
for( Integer indexA = 0; indexA<animals.length; indexA++ ) {
SJointedModel animal = animals[i];
animal.say( sayings[i] );
}
}