Question: a . have a Pet interface that exports abstract methods for the String name ( ) and int age ( ) of the pet. b
a have a Pet interface that exports abstract methods for the String name and int age of the pet.
b create a Lizard and Dog class that both implement the Pet interface.
c make Pet sortablecomparable to other Pet objects, ie: interface Pet extends Comparable
NB: Comparable is a standard java interface one can use to "tag" you custom objecttype as being 'naturally sortable' via the java collections framework
d implement the required compareTo method we'll say for any two pets p p that p 'comes before' p if page page
e add a PetRepo class that encapsulates a list of Pet objects currently in the pet shop. This class should have the following public API:
void sort method that sorts the underlying collection of pets using Collections.sort
void addPet p takes a pet and adds it to the list of Pet objects
void clear empties out the pets list
String toString override toString to render to the toString for each pet on its own line.
Next, add a package for the view and the event handling logic. Follow the approach demonstrated and worked so far in class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
