#1public class Elephant1 {#2private int weight; public Elephant1(int aWeight) { this.weight = aWeight; } public int getWeight() { return weight; } }
#1public class PopcornMachine1 {#2private int weight; public PopcornMachine1(int aWeight) { this.weight = aWeight; } public int getWeight() { return weight; } }
#1public class Zoo1 { private String name;#2private List<Object> objects;
public int getTotalWeight() { int totalWeight = 0; for (Object eachObject: this.objects) totalWeight += eachObject.getWeight(); return totalWeight; }