A class named MyPoint represents a point with x and ycoordinates.
The class contains:
* Two data fields x and y the represent the coordinates,
* A noargument constructor that creates a point (0, 0),
* A constructor that constructs a point with specified coordinates,
* Two get functions 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. For given the two points (x1, y1) and (x2, y2),
the distance between these points is given by the formula:
v( x2x1)2+ (y2y1)2
Create a class named ThreeDPoint to model a point in a threedimensional space.
Let the ThreeDPoint be derived from MyPoint with the following features:
A data field named z that represents the zcoordinate,
A noargument constructor that constructs a point with coordinates (0, 0 ,0),
A get function that returns the z value,
Override of the distance function to return the distance between two points in
the threedimensional space.
Draw the UML diagram for the classes involved. 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.
======================
*Instant Download
A class named MyPoint represents a point with x and ycoordinates
 Technology: CPPProgramming
 Code: SHC_CPP_10002

$9.99
Tags: ThreeDPoint, MyPoint, cpp, point, x and ycoordinates, noargument constructor, distance, cpp, class