Homework 12: More Help for Santa

Submit this homework using Gradescope. You can type up your answers, or write legibly and scan them. Do not attempt to submit a paper copy in class, as it will not be accepted.


Suppose you want to add some more functionality to the SleighTrack class we wrote in class. Each of the following should be instance methods you add to SleighTrack:

A. (1 point) Write a public boolean allVisited(Set<Location> locations) method that returns true iff the current SleighTrack instance has visited all of the given locations.

B. (1 point) Write a public int mostPresents() method that returns the highest number of presents delivered to a single location in the current SleighTrack.

C. (1 point) Write a public void presentsToCoal(Set<Location> locations) method that removes the given locations from the current SleighTrack, if they are in it. So mean!

It is possible (but not required) to do each of these without an explicit for loop, by using methods of Map and other classes.