Implement the class Point3D. Put the class definition in the header p1.h and the implementation in the pl.cpp file. You may not have any inline functions defined in the header file. Use the file xercise.cpp to check if your implementation is syntactically correct. • The class has three data members: X, y, and z, which are double. • The default constructor initializes the Point3D to the origin (0, 0, 0), while the working constructor supplies values for X, y, and z: all doubles in that order. • Create accessors getX(), getY() and getZ(). There are no mutators. (The class is immutable) • Write a member function distance() that returns the distance between the current Point3D (the implicit parameter which will be the left-hand side of an expression) and a second Point30 passed as an explicit parameter (which will be the right-hand-side of the expression). Here is the distance formula for a 3D point: V (xi -x2 }+ (yı -y: )'+ (zı -z2 )
Implement the class Point3D. Put the class definition in the header p1.h and the implementation in the pl.cpp file. You may not have any inline functions defined in the header file. Use the file xercise.cpp to check if your implementation is syntactically correct. • The class has three data members: X, y, and z, which are double. • The default constructor initializes the Point3D to the origin (0, 0, 0), while the working constructor supplies values for X, y, and z: all doubles in that order. • Create accessors getX(), getY() and getZ(). There are no mutators. (The class is immutable) • Write a member function distance() that returns the distance between the current Point3D (the implicit parameter which will be the left-hand side of an expression) and a second Point30 passed as an explicit parameter (which will be the right-hand-side of the expression). Here is the distance formula for a 3D point: V (xi -x2 }+ (yı -y: )'+ (zı -z2 )
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 15PE
Related questions
Question
I'm stuck
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning