Question: (The MyPoint class) Design a class named MyPoint to represent a point with x and y-coordinates. The class contains: 1) Two data fields x and
(The MyPoint class) Design a class named MyPoint to represent a point with x and y-coordinates. The class contains:
1) Two data fields x and y that represent the coordinates.
2) A default constructor that creates a point (0, 0).
3) A constructor that constructs a point with specified coordinates.
4) Two get functions for data fields x and y, respectively.
5) A function move that moves the point to the specified coordinates.
6) 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
PLEASE show the main code as well if possible do it with a header file as well as a implementation file and finally the main file PLEASE and thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
