# C++ language Define the class Point in a rectangular coordinate system Solution

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.

1.

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

2.

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

3.

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

4.

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. √×² +y²

• 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 =√(x - x)² + (y - y)²

¹ ² ¹ ²

1.

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.

2.

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

Define the class Point in a rectangular coordinate system. This class must have two double type private data members locationXand locationY.

1.

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

2.

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

3.

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

4.

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. √×² +y²

• 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 =√(x - x)² + (y - y)²

¹ ² ¹ ²

1.

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.

2.

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

You'll get 1 file (1.2KB)