import java.util.*; public class PetRanker { public static void main(String[] args) { List pets = new ArrayList(); pets.add(new StudentPet("Clifford", "dog", 7, 900)); pets.add(new StudentPet("Gerald", "goldfish", 50, 10)); pets.add(new StudentPet("Garfield", "cat", 10, 15)); pets.add(new StudentPet("Nemo", "clownfish", 10, 5)); pets.add(new StudentPet("Gerald", "catfish", 50, 10)); // Gerald the catfish will be placed right before Gerald the goldfish // due to the tiebreaks System.out.println("Pets before ranking"); System.out.println(pets); System.out.println("pets after ranking"); Collections.sort(pets); System.out.println(pets); } }