Question: 5. Write a class that represents a point in a 2D coordinate plane and call it Point. The constructor for a point object should take

5. Write a class that represents a point in a 2D coordinate plane and call it Point. The constructor for a point object should take both an x and a y coordinate. The class should also provide a getDistance function that takes another point, and returns the distance between itself and the other point. Use the following code, you should not need to modify provided code, just add the class as described. al Exam.md 6/11/2018 import math # TODO: define a class Point' which represent a location in the coordinate plane # The class should have a constructor that takes both and .x' and a 'y value # The class should have a "getDistance' function that returns the distance between # the point and another point object # NOTE: you should not modify any of the code below this line a-Point(1, 1) b Point(1, 2) dist a.getDistance(b) print("the distance is:"str (dist)) cPoint (5, 7) dist a.getDistance(c) print("the distnace is:"str (dist)) dist b.getDistance(c) print("the distance is:"str (dist)) Example output: the distance is: 1.0 the distnace is: 7.211102558927978 the distance is: 6.4831242374328485
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
