Question: Define a class called Point which has two private data members, x and y which are float. Define getx ( ) and getY ( )

Define a class called Point which has two private data members, x and y which are float.
Define getx() and getY() functions to return x and y components of a Point object. Please infer their return types by yourselves.
Define a private function, void checkEntry () which quits your program if the user enters any negative value
Define a default constructor which initializes x and y with 0
Define a constructor which initializes x with a user defined value, but sets y to 0. Please also check whether the values are valid by using void checkEntry().
Define a constructor which initializes both x and y with user defined values. Please also check whether the values are valid by using void checkEntry ().
Define three Point objects, p1, p2, and p3 by using your three constructors. You can use any non-negative number for initialization.
Display current values of your points.
Add list initialization to your constructors once you make sure they're working.
Define a function, float Manhattan (...) which takes two Point objects and calculates the distance between those two based on Manhattan distance defined below:
d=|x1-x2|+|y1-y2|
(Optional) Define a function, float Euclidean (...) which takes two Point objects and calculates the distance between those two based on Euclidean distance defined below:
d=(x1-x2)2+(y1-y2)22
 Define a class called Point which has two private data members,

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!