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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started