Question: IN JAVA PLZ 2. Create an Animal array with a size 5. a. Store the 5 different Animal objects from the Main class into the

 IN JAVA PLZ 2. Create an Animal array with a size5. a. Store the 5 different Animal objects from the Main class

IN JAVA PLZ

2. Create an Animal array with a size 5. a. Store the 5 different Animal objects from the Main class into the array. b. Create a method that prints out the contents of an Animal array. c. Using selection sort, sort the Animals in ascending order based on the number of legs. Use the method on your Animal array. d. Display the array of Animals. e. Using the improved linear search algorithm, create a method that will find an Animal object based on the number of legs. Your method should take in an Animal array and numOfLegs (key) as the parameters. If the Animal is found, return true, else, return false. \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ Mammal } \\ \hline -eggLaying: boolean \\ -habitat: String \\ \hline +Mammal() \\ +Mammal(eggLaying:boolean, habitat:String, numOfLegs:int, diet: String) \\ +getEggLaying(: boolean \\ +getHabitat: String \\ +setEggLaying(boolean eggLaying) \\ +setHabitat(String habitat) \\ +toString0: String \end{tabular} \begin{tabular}{|l|} \hline \multicolumn{1}{|c|}{ Horse } \\ \hline -color: String \\ \hline +Horse(color: String) \\ + getColor(): String \\ +setColor(String color) \\ +equals(Horse horse): boolean \\ \hline \end{tabular}

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!