Question: Please do in Python and not something else!!!!! (The Point class) Design a class named Point to represent a point with x- and ycoordinates. The
Please do in Python and not something else!!!!! (The Point class) Design a class named Point to represent a point with x- and ycoordinates. The class contains:
Two private data fields x and y that represent the coordinates with get methods.
A constructor that constructs a point with specified coordinates with default point (0, 0).
A method named distance that returns the distance from this point to another point of the Point type.
A method named isNearBy(p1) that returns true if point p1 is close to this point. Two points are close if their distance is less than 5.
Implement the _ _str_ _ method to return a string in the form (x, y). Draw the UML diagram for the class, and then implement the class. Write a test program that prompts the user to enter two points, displays the distance between them, and indicates whether they are near each other. Here is a sample run:
Enter two points x1, y1, x2, y2: 2.1, 2.3, 19.1, 19.2
The distance between the two points is 23.97
The two points are not near each other
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
