epresenting a point in the plane, a class named PlanePoint has • Two data members i.e. X and Y (correspond to x and y coordinates) of integer type, • Two accessor functions named as getX() and getY() to get values of data members X and Y • A function named planeDistance() that calculates and returns the distance between two points in a plane Derive a class named SpacePoint to imagine a point in a three-dimensional space and has following additional features: • A data member Z of type integer to represent the z-coordinate of a point in space • A no-argument constructor that constructs a point with coordinates (0,0,0) • A constructor with three arguments that constructs a point with three specified coordinate values • An accessor function, which returns the value of data field Z • A function named spaceDistance to return the distance between two points in the space Implement both the classes and in the main() create two points with different dimensions and invoke appropriate function to display the distance between these two points
Representing a point in the plane, a class named PlanePoint has
• Two data members i.e. X and Y (correspond to x and y coordinates) of integer type,
• Two accessor functions named as getX() and getY() to get values of data members X and
Y
• A function named planeDistance() that calculates and returns the distance between two
points in a plane
Derive a class named SpacePoint to imagine a point in a three-dimensional space and has
following additional features:
• A data member Z of type integer to represent the z-coordinate of a point in space
• A no-argument constructor that constructs a point with coordinates (0,0,0)
• A constructor with three arguments that constructs a point with three specified coordinate
values
• An accessor function, which returns the value of data field Z
• A function named spaceDistance to return the distance between two points in the space
Implement both the classes and in the main() create two points with different dimensions and
invoke appropriate function to display the distance between these two points.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images