Lecture Notes on 12 Sep 2022 import math class Point (object): # constructor def __init__ (self, x = 0, y = 0): self.x = x self.y = y # get the distance to another Point object def dist (self, other): return math.hypot (self.x - other.x, self.y - other.y) # string representation of a Point object def __str__ (self): return '(' + str(self.x) + ', ' + str(self.y) + ')' # test for equality of two Point objects def __eq__ (self, other): tol = 1.0e-6 return ((abs(self.x - other.x) < tol) and (abs(self.y - other.y) < tol)) def main(): # create Point objects a = Point() b = Point (3, 4) c = Point (3, 4) d = Point (b.x, b.y) # print the Point objects print (a) print (b) print (c) print (d) # print the distance between two Point objects print (a.dist(b)) print (b.dist(a)) # test for equality if (b == c): print ("Point objects are equal") else: print ("Point objects are not equal") if (b == d): print ("Point objects are equal") else: print ("Point objects are not equal") main()