Problem

(Extend MyPoint) In Programming Exercise, the MyPoint class was created to model a point i...

(Extend MyPoint) In Programming Exercise, the MyPoint class was created to model a point in a two-dimensional space. The MyPoint class has the properties x and y that represent x - and y -coordinates, two get functions for x and y , and the function for returning the distance between two points. 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 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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT