Create the following animals:
Horse
is a concrete class which implements Animal.move
will return the string"gallop"
color
will return the string"brown"
(Yes I am aware not all horses are brown.)getSpeed
will return40
Bird
is an abstract class that implements Animal.move
will return the string"fly"
(Yes I am aware not all birds fly.)
BlueJay
is a concrete class which extends from Birdcolor
will return the string"blue"
speed
will return13
RedRobin
is a concrete class which extends from Birdcolor
will return the string"red"
speed
will return10
- Add a
String migrationMonth
field. Add a getter and setter for it.
- Create a SpeedComparator class. The class should implements
Comparator<Animal>
- Implements the
int compare(Animal animal1, Animal animal2)
method - If animal1's and animal2's speed are the same, then return 0
- If animal1's speed is greater than animal2 speed, then return a negative number
- If animal1's speed is less than animal2 speed, then return a positive number