Implemented the distanceTo function in the Location2D class