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 1Create a new project named lab1_1 and create a class named Point to represent in a point in 2 dimensional space.The Point class will have two protected member variables named x and y.This 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 y.There 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:(2,3)for a point with coordinates (2,3). Make sure to test this with a driver file.Part 2Continue with the lab1_1 project and create a class named Point3D to represent a point in 3-dimensional space. This class will inherit its members from the Point class you created in Part 1.The Point3D class will add a protected member variable named z.This 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 z.There 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 Point3D, it will print the coordinates as:(2,1,3)for a point with coordinates (2,1,3). Make sure to test this with a driver file.Part 3Create a stand alone function that takes two Point3D objects as arguments and calculates the distance between them.The distance between two points P1=(x1, y1, z1) and P2=(x2, y2, z2) in 3D-space is given by the following generalization of the distance formula,Formula for distance between 2 pointsSample Execution:Enter the x, y, and z coordinates of your point: 231Here is your point: (2,3,1)Enter the x, y, and z coordinates of your next point: 8-50Here is your point: (8,-5,0)The distance between both points is: 10.0499

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!