Question: this problem for full credit. Late submissions lose 2 points per day. Next Let's create a program to allow us to track visits to different
this problem for full credit. Late submissions lose points per day.
Next
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:
countVisit accepts a String and increments the visit count for that location
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:
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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
