Question: please write the code in c++ please (The MyPoint class) Design a class named MyPoint to represent a point with x and y-coordinates. The class

please write the code in c++ please

(The MyPoint class) Design a class named MyPoint to represent a point with x and y-coordinates. The class contains:

Two data fields x and y that represent the coordinates.

A default constructor that creates a point (0, 0).

A constructor that constructs a point with specified coordinates.

Two get functions for data fields x and y, respectively.

A function move that moves the point to the specified coordinates.

A function named distance that returns the distance from this point to another point of the MyPoint type.

Draw the UML diagram for the class MyPoint. Implement the class MyPoint. Write a test program that creates two points (0, 0) and (10, 20.8) and displays the distance between two points. Then move two points to (-10, -10) and (30.1, 101), and displays the distance between two points. Here is a sample run:

The first point is (0, 0)

The second point is (10, 20.8)

The distance between two points is 23.08 The first point is moved to (-10, -10) The second point is moved to (30.1, 101) The distance between two points is 118.02

write the code in c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!