Question: i need help with a home work that has been pain, its about inheritance and arrayList. Does anyone know how to do this? DataStructuresAndIn... Run

DataStructuresAndIn... Run Conso OpenC .04.1 O > Main.java 1 public class Main { 2 public static void main(String[] args) { 3 1/ Please Look through the code for the other classes first!! ArrayList animallist = new ArrayList(); 5 System.out.println("Jeff is gay"); 6 7 1/ Create an ArrayList of at least 6 objects (of mixed reference type!), make 8 // the arrayList of the SuperClass type! 9 // Loop through the arrayList and print out the height of the tallest Animal 10 11 1/ Create an array of type Animal, and size 5 12 13 // add 5 elements into the array 14 15 // Loop through the array and display the average age of all the Animals 16 17 18 19 MacBook Pro Animal.java 1 class Animal 2 3 int age; 4 double height; 5 6 public Animal({ 7 age = 0; 8 height = 12.5; 9 } 10 11 public Animal(int age, double height){ 12 this.age = age; 13 this.height = height; 14 } 15 16 //other methods would go here but not necessary for this exercise 17 MacBook Pro class Mammal extends Animal OF int litterSize; double hairLength; a 1 2 3 4 5 6 7 8 9 10 11 12 public Mammal super(); litterSize = 1; hairLength = 2.2; } 13 14 15 16 17 public Mammal(int age, double height, int litterSize, double hairLength) { super(age, height); this. litterSize = litterSize; this.hairlength = hairLength; 3 MacBook Pro
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
