use java to Design and implement a class named MyPoint to represent a point with x- and y-coordinates. The class contains: The private double data fields x and y that represent the coordinates with getter methods. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. A method named distance that returns the distance from this point to a specified point of the MyPoint type. A method named distance that returns the distance from this point to another point with specified x- and ycoordinates. A static method named distance that returns the distance from one point with specified x- and y-coordinates (e.g. (x1, y1)) to another point with specified x- and y-coordinates (e.g. (x2, y2)). Write a test program that creates the two point objects with (0, 0) and (10, 30.5) coordinates and displays the distance between them.
use java to Design and implement a class named MyPoint to represent a point with x- and y-coordinates. The class contains: The private double data fields x and y that represent the coordinates with getter methods. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. A method named distance that returns the distance from this point to a specified point of the MyPoint type. A method named distance that returns the distance from this point to another point with specified x- and ycoordinates. A static method named distance that returns the distance from one point with specified x- and y-coordinates (e.g. (x1, y1)) to another point with specified x- and y-coordinates (e.g. (x2, y2)). Write a test program that creates the two point objects with (0, 0) and (10, 30.5) coordinates and displays the distance between them.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images









