Discuss the below:
Q: Design a Java class named MyPoint to represent a point with x and y coordinates. This class should contain:
- Two data fields x and y that represent the coordinates.
- A no-argument constructor that creates a point (0, 0).
- A constructor that constructs a point with specified coordinates.
- Two get methods for data fields x and y, respectively.
- A method named distance that returns the distance from this point to another point of the MyPoint type.
- A method named distance that returns the distance from this point to another point with specified x and y coordinates.
Implement the class, and also write a test program that creates two points (0, 0) and (10, 30.5) and displays the distance between them.