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

 Please use the following methods/functions. I am confused on how to
create a subclass in Java using Eclipse. Q1) Create a java package
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 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!