Do it in C++ (The MyPoint class) Design a class named MyPoint to represent a point with x- and y-coordinates. The class contains: Two data fields x and y that represent the coordinates. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. Two get function for data fields x and y, respectively. A function named distance that returns the distance from this point to another point of the MyPoint Type. Draw the UML diagram the class. Implement the class. Write a test program that creates two points (0, 0) and (10, 30.5) and displays the distance between them.
Do it in C++
(The MyPoint class) Design a class named MyPoint to represent a point with
x- and y-coordinates. The class contains:
Two data fields x and y that represent the coordinates.
A no-arg constructor that creates a point (0, 0).
A constructor that constructs a point with specified coordinates.
Two get function for data fields x and y, respectively. A function named distance that returns the distance from this point to
another point of the MyPoint Type.
Draw the UML diagram the class. Implement the class. Write a test
creates two points (0, 0) and (10, 30.5) and displays the distance between them.
Further create a class named ThreeDPoint to model a point in a three-dimensional
space. Let ThreeDPoint be derived from MyPoint with the following additional
features:
A data field named z that represents the z-coordinate.
A no-arg constructor that constructs a point with coordinates (0, 0, 0).
A constructor that constructs a point with three specified coordinates.
A constant get function that returns the z value.
A constant distance (const MyPoint &) function to return the distance
between this point and the other point in the three-dimensional space.
Draw the UML diagram of the ThreeDPoint class. Implement the classes.
Write a test program that creates two points (0, 0, 0) and (10, 30, 25.5) and displays the
distance between them

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







