Write a class Point that represents a point in 3D cartesian coordinate system. Use Constructors or input functions to initialize the co-ordinate values. Compare the two points P1 and P2 and tells which point is greater than the other. You should do this by calculating the distance of each point from origin(0,0,0). P1 will be greater if its distance from origin is greater than P2's distance from origin. Use operator overloading concept to compare P1 and P2. Write a testing function and compare the points in the main/testing function and print the output accordingly. Hints: 1) perform operator overloading as non-member function. Within the class write as: friend bool operator > (pointP & p, pointP & q); 2)You can also do operator overloading as a member function. Plz be careful about the syntax/arguments.(for whichever option you choose) 3) The distance formula is given below: D= (x2 – x1)2 + (y2 – y1)² + (z2 – z1)?
Write a class Point that represents a point in 3D cartesian coordinate system. Use Constructors or input functions to initialize the co-ordinate values. Compare the two points P1 and P2 and tells which point is greater than the other. You should do this by calculating the distance of each point from origin(0,0,0). P1 will be greater if its distance from origin is greater than P2's distance from origin. Use operator overloading concept to compare P1 and P2. Write a testing function and compare the points in the main/testing function and print the output accordingly. Hints: 1) perform operator overloading as non-member function. Within the class write as: friend bool operator > (pointP & p, pointP & q); 2)You can also do operator overloading as a member function. Plz be careful about the syntax/arguments.(for whichever option you choose) 3) The distance formula is given below: D= (x2 – x1)2 + (y2 – y1)² + (z2 – z1)?
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 17RQ
Related questions
Question
solve the question as according to c++
![Q1. [CLO-3] (10)
Write a class Point that represents a point in 3D cartesian coordinate system. Use Constructors or input
functions to initialize the co-ordinate values.
Compare the two points P1 and P2 and tells which point is greater than the other. You should do this by
calculating the distance of each point from origin(0,0,0). P1 will be greater if its distance from origin is
greater than P2's distance from origin.
Use operator overloading concept to compare P1 and P2. Write a testing function and compare the
points in the main/testing function and print the output accordingly.
Hints: 1) perform operator overloading as non-member function.
Within the class write as:
friend bool operator > (pointP & p, pointP & q) ;
2)You can also do operator overloading as a member function. Plz be careful about the
syntax/arguments.(for whichever option you choose)
3) The distance formula is given below:
D= (x2 – x1)2 + (y2 – y1)? + (z2 – z1)?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F40547f5e-c5fb-4cbb-9263-6bbe5ad47f39%2F38076092-26b8-49f5-9bef-12632120f1e4%2Figp7uqn_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Q1. [CLO-3] (10)
Write a class Point that represents a point in 3D cartesian coordinate system. Use Constructors or input
functions to initialize the co-ordinate values.
Compare the two points P1 and P2 and tells which point is greater than the other. You should do this by
calculating the distance of each point from origin(0,0,0). P1 will be greater if its distance from origin is
greater than P2's distance from origin.
Use operator overloading concept to compare P1 and P2. Write a testing function and compare the
points in the main/testing function and print the output accordingly.
Hints: 1) perform operator overloading as non-member function.
Within the class write as:
friend bool operator > (pointP & p, pointP & q) ;
2)You can also do operator overloading as a member function. Plz be careful about the
syntax/arguments.(for whichever option you choose)
3) The distance formula is given below:
D= (x2 – x1)2 + (y2 – y1)? + (z2 – z1)?
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
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 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning