Question: In java complete the sort method on the SortDog class as described below. /** * Class that sorts an array of Dogs. */ public class

In java complete the sort method on the SortDog class as described below.

/** * Class that sorts an array of Dogs. */ public class SortDog extends Dog { /* * Compare one Dog to another Dog. * * If the other Dog is greater than this Dog, returns "bite". * If they are the same, returns "sniff". * If the other Dog is less than this Dog returns "lick". * * @param otherDog other Dog to compare to * @return "bite" if the other Dog is greater, "sniff" if they are the same, * and "lick" if the other Dog is lesser * * public final String compare(final Dog otherDog) */

/** * Sort the array of Dog objects in ascending order. * * You may return either a reference to a new array or to the passed array. * Note that you may not the Arrays utility class. * * You will need to use the Dog compare instance method described above to compare * one Dog to another Dog. * * @param array the array of Dogs to sort * @return a reference to the sorted array */ public static Dog[] sort(final Dog[] array) { return array; } }

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!