Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the MainKingdom Class with a main method that instantiates Human. The hierarchy is human, mammal, chordats animal kingdom. (Note: sub classes and super classes).

Write the MainKingdom Class with a main method that instantiates Human. The hierarchy is human, mammal, chordats animal kingdom. (Note: sub classes and super classes).

public String toString() returns the object name along with a list of where it is in the classification of living organisms. For instance, the method on an object named Ricky of the class Raccoon, should return something like Ricky (Raccoon, Mammal, Chordata, Animal Kingdom)

package animal; public class Human extends Mammal { //constructor  public Human() { } public void bendThumb() { System.out.println(getName() + " is bending their thumbs"); } @Override public String toString() { return super.toString() + ", Human"; } } 

package animal; public class Mammal extends Chordata { public void drinkMilk() { System.out.println(super.getName() + " is drinking milk"); } @Override public String toString() { return super.toString() + ", Mammal"; } }

package animal; public class Chordata extends AnimalKingdom { @Override public String toString() //Ricky(Raccoon, Mammal, Animal Kingdom)  { return super.toString() + ", Chordata"; } }

package animal; public class AnimalKingdom { private String name; private String animalType; public AnimalKingdom(String name, String animalType) { this.name = name; this.animalType = animalType; } AnimalKingdom() { } public String getName() { return name; } public String getAnimalType() { return animalType; } @Override public String toString() //Ricky(Raccoon, Chordata, Mammal, Animal Kingdom)  { return name + "(" + getAnimalType() + ", Mammal, Chordata, Animal Kingdom)"; } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

Who made the decision?

Answered: 1 week ago