For all following exercises, it is not required to implement the method, only to fix the compilation problems reported by the tests. It is of course forbidden to alter the tests.
The code should be as flexible as possible.
The Exercise1.isVaccinated()
should tell us if all animals in the list are vaccinated.
It should accept a list of animals and return a boolean.
The Exercise2.addAnimalOfTheMonth()
should add a random animal to the list. Its type may be different each month.
It should accept a list of animals and return nothing.
The Exercise3.sort()
method should sort a collection with the given comparator.
It should accept a collection and a comparator and return a list.
Romeu Moura taught me this exercise at SoCraTes FR 2018. I improved on it by adding automated tests that check the requirements.