4.1 Suppose that we wish to modify Programs 3.7 and 4.1 to count the number of pairs of points that fall within a square of size d. First, show how to solve this problem by modifying the distance method in the implementation (so that the client does not have to be changed). Second, show how to solve this problem by changing the client to use the accessor methods in the implementation (so that the implementation does not have to be changed).
4.2 Give an implementation of the point interface (Program 4.3) for points with three coordinates.
Define two points to coincide if the distance between them is less than 10-6. Add a method to the Point interface for testing whether two points coincide, then write a client program that takes an integer N from the command line and fills an array with N points, no two of which coincide.
Change both implementations of Point (Programs 4.1 and 4.2)such that the no-parameter constructor creates a random point in the unit circle.