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, and which are float.
Define getx and getY functions to return and 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 and with
Define a constructor which initializes with a user defined value, but sets to Please also check whether the values are valid by using void checkEntry
Define a constructor which initializes both and with user defined values. Please also check whether the values are valid by using void checkEntry
Define three Point objects, p p and p by using your three constructors. You can use any nonnegative 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:
Optional Define a function, float Euclidean which takes two Point objects and calculates the distance between those two based on Euclidean distance defined below:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
