Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Polymorphism Java Program I've created a driver program Animal Kingdom that creates some objects, but not all. I need help to finish the program, here

Polymorphism Java Program I've created a driver program "Animal Kingdom" that creates some objects, but not all. I need help to finish the program, here are my requirements: Please take your time and I appreciate your effort.

image

Here are the websites that I used for the animal info:
https://www.thoughtco.com/the-six-basic-animal-groups-4096604
https://www.kidzone.ws/animals/animal_classes.htm

And here's my unfinished driver program that you can work off of:|

 import java.util.*;  public class AnimalKingdomDriver {  public static void main(String[] args) {      ArrayList animalList = new ArrayList<>();   Bat bat = new Bat("Count Batula");   animalList.add(bat);   animalList.add(new BlueWhale("Blubby Blubs"));   animalList.add(new Cat("Ms. Purrfect"));   animalList.add(new Emu("Outback Ollie"));   animalList.add(new Goldfish("Sammy Swimmer"));   animalList.add(new Otter("Henry Handholder"));   animalList.add(new Parakeet("Songbird Stu"));   animalList.add(new Turtle("Shelly Silversteen"));      System.out.println("***** Here are all the animals. (8 animals printed)");   for(Animal animal : animalList) {    System.out.println(animal);   }      System.out.println("\n\n***** Check on the equals method.");    Bat batTest = new Bat(new String("Count Batula"));   System.out.println("Should print true: " + bat.equals(batTest));   batTest = new Bat(new String("COUNT BATULA"));   System.out.println("Should print true: " + bat.equals(batTest));   batTest = new Bat(new String("Batman"));   System.out.println("Should print false: " + bat.equals(batTest));      System.out.println("\n\n***** Here are just the mammals. (4 animals printed)");   for(Animal animal : animalList) {    // YOUR CODE HERE   }      System.out.println("\n\n***** Here are the winged animals along with information about whether they can fly.  (3 animals printed)");   for(Animal animal : animalList) {    // YOUR CODE HERE   }      System.out.println("\n\n***** Here are the adoptable animals along with their care directions.  (4 animals printed)");   for(Animal animal : animalList) {    // YOUR CODE HERE   }        System.out.println("\n\n***** Here are the animals that can dwell in water, along with whether they can also live on land.  (4 animals printed)");   for(Animal animal : animalList) {    // YOUR CODE HERE   }      }  }

I need to write classes or interfaces to represent the following: Adoptable Animal Bat Bird BlueWhale Cat Emu Fish Goldfish Mammal Otter Parakeet Reptile Turtle WaterDweller Whale - - Winged All animals have a name All animals must have a method "isWarm Blooded" that returns a boolean (Method can be in the class directly or inherited) All classes must have a to String method that returns: the animal's name, whether it's blood is warm, and a list of all animal names that apply to the animal. Animals that can be adopted (Cat, Bird..) have a method "homeCareDirections" that returns a text description of how to care for the animal. Animals that live in water (water dwellers) have a method "canLiveOutOfWater" that returns a boolean of whether the animal also can live out of the water (on land). Animals that have wings have a method "canFly" that returns a boolean of whether the animal can fly. Declare classes that should not be instantiated as abstract please. For the driver program, please include polymorphism. I can provide two websites that I used for animal info, in case you need it: If possible, try to provide an equals Method in the Animal class. Two animals are logically equivalent if they have the same name (ignoring capitalization) and the same warm blooded status. No need to override the equals method in any other class.

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_2

Step: 3

blur-text-image_3

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

Fundamentals of Case Management Practice Skills for the Human Services

Authors: Nancy Summers

5th edition

1305094765, 130509476X, 9781305544833 , 978-1305094765

More Books

Students also viewed these Programming questions

Question

Briefly describe Kants theory of moral development.

Answered: 1 week ago

Question

Explain the importance of Human Resource Management

Answered: 1 week ago