The last task is solved by simply following the following lesson: https://www.geeksforgeeks.org/system-design/service-locator-pattern/
However, I'm not sure what exactly I've learned from this.
The service locator is actually a nice exercise, after you read the posts Gaby and BJB recommended below. Although the one from Gaby was sufficient for me because it was well worded and the example was clear.
This is a very good tutorial for the Service Locator Pattern: https://www.tutorialspoint.com/design_pattern/service_locator_pattern.htm
You should also read this article before these exercises... really wish I had, now everything makes sense
https://codegym.cc/groups/posts/211-rmi-in-practice
GO TO FULL VERSION