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)?

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 17RQ
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)?
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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.
Similar questions
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning