11: 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. (It is possible to do this one without using a for loop.)

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. (It is possible to do this one without a for loop, but you’ll need to read over the instance method of Map and the static methods of Collections to see how.)

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 to do this one without a for loop, but you’ll need to carefully read over the instance methods of Map to see how.)