Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started