Answered step by step
Verified Expert Solution
Link Copied!

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, 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

7.59 Explain the difference between an x chart and a p chart.

Answered: 1 week ago