Commit 3dd4a863 authored by a-j.towse's avatar a-j.towse

Working version with DisplayAnimalFoodList

parent bec6856b
No preview for this file type
No preview for this file type
import java.util.ArrayList;
public class App { public class App {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
...@@ -17,8 +19,10 @@ public class App { ...@@ -17,8 +19,10 @@ public class App {
myZoo.displayfoodRequirements(Rex); myZoo.displayfoodRequirements(Rex);
myZoo.displayfoodRequirements(Pix); myZoo.displayfoodRequirements(Pix);
ArrayList<Animal> animalFoodReqList = new ArrayList<>();
animalFoodReqList.add(Rex);
animalFoodReqList.add(Pix);
myZoo.displayfoodListRequirements(animalFoodReqList);
} }
......
...@@ -21,6 +21,12 @@ public class Zoo { ...@@ -21,6 +21,12 @@ public class Zoo {
System.out.println(animal.getFoodType()); System.out.println(animal.getFoodType());
} }
public void displayfoodListRequirements(ArrayList<Animal>animalList){
for (int i=0; i < animalList.size();i++){
System.out.println(animalList.get(i).getFoodType());
}
}
public void displayDetails(Animal animal){ public void displayDetails(Animal animal){
ArrayList<String> detailList=animal.getDetails(); ArrayList<String> detailList=animal.getDetails();
for(int i = 0; i < detailList.size();i++){ for(int i = 0; i < detailList.size();i++){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment