Question: Java: This exercise demonstrates how you can create an application with complex class and interface relationships and utilize interfaces to achieve multiple inheritance (remember that

Java:

Java: This exercise demonstrates how you can create an application with complex

This exercise demonstrates how you can create an application with complex class and interface relationships and utilize interfaces to achieve multiple inheritance (remember that in Java you cannot inherit from multiple classes). Below is a high-level UML class diagram for the classes in this exercise: Swim Animal Dog cc interface Domesticated Wha CM Rani inte face >> Scratcher Define and implement the following classes Dog, Cat, Racoon, Whale. Save the class definitions into filcs named Dog.java, Cat.java, Racoon.java, Whale.java. Fach of these classes should define or inherit the following attributes: type of the animal, name of the animal, age, male or female, which environment it lives in (home for dogs and cats, forest for racoons, ocean for whales), and how fast it moves (c.g. x miles/hr). Each of these classes should contain getters and setters for all their attributes. Each of these classes should have the following functionality where the action is simply printed to command line: move(), sound(), cal(), sleep(), toString(). All classes are a type of animal. Some of the classes are domesticated (for example, you could introduce Domesticated interface to your design). Being domesticated introduces additional functionality: walk(), greetHuman(). Some of the classes are swimmers, which adds functionality swim(). Dog has an additional functionality bark(). Both Racoon and Cat can scratcho. Deline and implement class AnimalTest. This class should implement main() method. In the body of the main() method you should create one instance of your classes Dog, Cat, Racoon, and Whale. On each instance call each one of the possible functionalities (methods representing those functionalities). These calls should just output the appropriate action to command line. For example, calling method walk() should output something like "Walking. For visual presentation make sure to include an empty line between the outputs for each animal instance. Save this class and its definition into a file named AnimalTest.java

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!