Next
Java
this problem for full credit. Late submissions lose 2 points per day.
Let's create a program to allow us to track visits to different locations. Create a public class
TrackVisits with a single constructor accepting a List of Strings, each identifying a place
that you should track visits for. If the list passed the constructor is null or empty, throw an
IllegalArgumentException.
Also provide two instance methods:
1. countVisit accepts a String and increments the visit count for that location
2. getVisitCount accepts a String and returns the visit count for that location
If the String passed to either countVisit or getVisitCount is null, throw an
IllegalArgumentException. If the String passed to either method was not passed to the
constructor, throw a PlaceNotFound exception, which you can create without importing:
1 throw new PlaceNotFound();
Note that this is a checked exception!
You must use a Map to solve this problem, and should not declare any other fields.
WORKING
PREVIOUS