Question: Requirements In a new Eclipse project, create the following: public abstract class Pet has these private attributes name : String gender : char acquired :
Requirements In a new Eclipse project, create the following: public abstract class Pet has these private attributes name : String gender : char acquired : Date has these public methods one constructor getName() getGender() getAcquired() abstract method sound() that returns a String public interface Mobility has one abstract method move() that returns a String concrete class Dog that extends Pet and implements Mobility and Comparable has these private attributes breed : String weight : int has these public methods one constructor getBreed() getWeight() sound() move() compareTo(Dog arg0) that compares dogs by weight toString() that returns a string fully describing a Dog instance concrete class Reptile that extends Pet and implements Mobility has one private attribute type : String has these public methods one constructor getType() sound() move() toString() that fully describes a Reptile instance executable class TestPet creates at least one Reptile pet and displays it creates an array of at least four Dog pets sorts the array of Dogs by weight uses a foreach loop to fully display all data for all dogs sorted by weight (see sample output) Sample Output Reptile name = Slinky, rock python, M Must be caged, crawls or slithers Sound Does not make a sound, acquired Fri Feb 03 17:06:54 EST 2017 Dog name = Pedro, chihuahua, M Walks on a leash, weight 14 Makes sound bark woof!, acquired Fri Feb 03 17:06:54 EST 2017 Dog name = Marley, pug, M Walks on a leash, weight 20 Makes sound bark woof!, acquired Fri Feb 03 17:06:54 EST 2017 Dog name = Sacha, beagle, F Walks on a leash, weight 25 Makes sound bark woof!, acquired Fri Feb 03 17:06:54 EST 2017 Dog name = Butch, Alsatian, M Walks on a leash, weight 90 Makes sound bark woof!, acquired Fri Feb 03 17:06:54 EST 2017
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
