Question: Please use the following methods/functions. I am confused on how to create a subclass in Java using Eclipse. Q1) Create a java package called Lab10-Q1
Q1) Create a java package called Lab10-Q1 with a class called Q1 that has the main function with the below code public static void main(Stringl args) Animal[] pet = new Animal[2]; pet[0] = new Dog("Buddy",41); pet[1] = new Cat("Whiskers" ,4); for (Animal i: pet) System.out.printin( The pet name is+i.getName0 +and it weights+i.getWeightPounds0+ pounds and says "+ ispeak0 ) Inside the java package add a base class called Animal, and two subclasses of Animal called Cat and Dog. An Animal should have a name and a weight, and be able to speak. A cat should "meow" and a dog should "bark" You should have the following functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
