Question: (in java programing language) pls help thank you [Q.2] Consider the class diagram shown below for the Animal class. Animal gender: type: -name: age: -weight:

 (in java programing language) pls help thank you [Q.2] Consider the

(in java programing language) pls help thank you

[Q.2] Consider the class diagram shown below for the Animal class. Animal gender: type: -name: age: -weight: +Animal() +Animal(gender) +Animal(gender, type) +Animal(gender, type, name) The-sign means private The + sign means public Animal(gender, type, name, age) +Animal(gender, type, name, age, weight) +getGender) +setGender(gender) +getType) +setType(type) +getName0) +setName(name) +getAge() +setAge(age) tgetWeight() +setWeight(weight) +toString) +equals0) 1- Provide the code for the class Animal and provide an implementation of the equals method based on the following fields: gender and name such that two Animal objects are equal if their gender and name fields are equal. Note that the field gender accepts either male or female values. The method toString should typically display message like: A male elephant named Jumbo 60 years old and weighs 7000 Kgs 2- Provide the code for the class Pet that extends the class Animal defined above. The class Pet has the following: a- A field called home that takes either indoor or outdoor values. b- A field called bites to tell whether the Pet animal can bite or not. Provide appropriate constructors and methods for class Pet. Make sure that the class Pet has its own implementation for the toString and equals methods

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!