Java programmers can use class hierarchies for the purposes of inheritance.

Feb 3rd, 2012
Studypool Tutor
Price: $20 USD

Tutor description

Java programmers can use class hierarchies for the purposes of inheritance. For example, given a Tree class, we could define Conifer and Deciduous sub classes that inherit from the parent Tree class as you can see here: Deliverable Develop a similar class hierarchy for Animals. You can have whatever subclasses you think would be useful. Your hierarchy should have at least three levels (the top class, Animals, counts as the first level). Include variables and methods (at least one of each) for each class you design, as in the above example.

Word Count: 603
Showing Page: 1/6
/** * Created by e7006722 on 4/07/2014. */public class Animal { private String name; @Override public String toString() { return "Animal{" + "name='" + name + '\'' + '}'; } public Animal() { } public Animal(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; }}/** * Created by e7006722 on 4/07/2014. */public class Mammal extends Animal { private String habitat; public Mammal() { } public Mammal(String habitat) { this.habitat = habitat; } public Mammal(String name, String habitat) { super(name); this.habitat = habitat; } @Override public String toString() { return "Mammal{" + "habitat='" + habitat + '\'' + '}'; } public String getHabitat() { return habitat; } public void setHabitat(String habitat) { this.habitat = habitat; } public void nurse() { System.out.println("Called the Mammal.nurse method"); }}/** * Created by e7006722 on 4/07/2014. */public class Oviparous extends Animal { private String dwelling; @Override public String toString() { return "Oviparous{" + "dwelling='" + dwellin

Review from student

Studypool Student
" Goes above and beyond expectations ! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1823 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors