Define and implement a second constructor function that


Assignment

Analyze each problem, develop a solution and implement your solution. Copy and paste your program and a sample output below each problem.
Define the class Point in a rectangular coordinate system. This class must have two double type private data members locationXand locationY.

Define and implement a default constructor for the Point class that sets the locations to (0, 0).

Overload the constructor - define and implement a second constructor function that receives two parameters to set the locations.

Define public assessor/get and mutator/set function for each of the private data members.

Define and implement a public method (member function) that returns the distance of the point from the origin. The distance of the point (x, y) from the origin is given by the formula. √x2 +y2

Write a non-member function theDistance() that receives two points and returns the distance between the two points. The distance between two points ( x1, y1) and (x2, y2) is given by : D =√(x2- x1)2 + (y2 - y1)2

Write a main function in which two points are instantiated (created). Call the print method of the two Point objects. Next call the non-member function theDistance() send the two points as parameters and display the distance between the two points.

Submit code with sample runs with (interesting) non-trivial input values.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Define and implement a second constructor function that
Reference No:- TGS01711321

Now Priced at $40 (50% Discount)

Recommended (99%)

Rated (4.3/5)