Question: 7. [30 marks (Extend MyPoint) In Assignment 1 Question 11, the MyPoint class was created to model a point in a two-dimensional space. The MyPoint

 7. [30 marks (Extend MyPoint) In Assignment 1 Question 11, the
MyPoint class was created to model a point in a two-dimensional space.

7. [30 marks (Extend MyPoint) In Assignment 1 Question 11, 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 move function to move the point to the specified coordinates, distance function for returning the distance bet ween two points In this que stion, please create a cass named ThreeDPoint to model a point in a three-dimensional space. Let ThreeDPoint be derived from MyPoint with the following additional features: An attribute named z that represents the z-coordinate. A default constructor that constructs a point with coordinates (0,0.0. A constructor that constructs a point with three specified coordinates Aget function that returns the z value. . Amove function that moves the point to the specified coordinates A distance (const ThreeDPoint& pl) function that returns the distance bet ween this point and the other point p1 in the three-dimen sional 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.0, 20.0, 30.0) and displays the distance between them. Then move two points to (10.0, 10.0. 10.0) and (20.0, 30.0 40.0) and displays the distance between two points. Here is a sample run: The first point is (0, 0, 0) The second point is (10.0, 20.0, 30.0) The distance between two points is 37.42 The first point is moved to (10.0, 10.0, 10.0) The second point is moved to (20.0, 30.0, 40.0) The distance between two points is 37.42 There will be at least four files need to be submitted for this program question. 1) a header file MyPoint.h which contains the definition of My Point class and ThreeDPoint class, 2) an implementation file MyPoint.cpp which contains the implementation of MyPoint class and ThreeDPoint class, 3) a client test file a3q7.cpp containing main ) function, 4) a script file a3q7result containing result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!