Question: Objective:After completion of this lab, you will be able torecall how to use classes, as well as composition and inheritanceLab ExercisesPart 1 Create a new
Objective:After completion of this lab, you will be able torecall how to use classes, as well as composition and inheritanceLab ExercisesPart Create a new project named lab and create a class named Point to represent in a point in dimensional space.The Point class will have two protected member variables named x and yThis class should contain two constructors: a default constructor, and an overloaded constructor, which takes two arguments, and uses these to set the coordinates of x and yThere will be setters and getters for x and y as well as a method named move, which move x and y with the amount specified by the arguments. There will also be a print method, which prints out the coordinates as:for a point with coordinates Make sure to test this with a driver file.Part Continue with the lab project and create a class named PointD to represent a point in dimensional space. This class will inherit its members from the Point class you created in Part The PointD class will add a protected member variable named zThis class should contain two constructors: a default constructor, and an overloaded constructor, which takes three arguments and uses these to set the coordinates of x y and zThere will be setters and getters for z and you will overload move, so it moves x y and z with the amount specified by the arguments. Also overload the output operator, so if you print out a PointD it will print the coordinates as:for a point with coordinates Make sure to test this with a driver file.Part Create a stand alone function that takes two PointD objects as arguments and calculates the distance between them.The distance between two points Px y z and Px y z in Dspace is given by the following generalization of the distance formula,Formula for distance between pointsSample Execution:Enter the x y and z coordinates of your point: Here is your point: Enter the x y and z coordinates of your next point: Here is your point: The distance between both points is:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
