Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Connect with professionals on our platform to receive accurate answers to your questions quickly and efficiently. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.

Write a class called point that represents a point in 2d plane.
- the constructor accepts the x and y dimensions of the point.
- provide a method getx that returns the x coordinate of a point, and another method gety
that returns the y coordinate of a point.
- provide a method called translate that changes the original coordinates of the point by
adding a given values for x and y coordinates.
- provide a method distanceto that calculates the distance between that point and another
one.
use this equation to calculate the distance math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2))
while the math is a library you should import. where the (x1, y) is the coordinates of the first point
and (x2, y2) is the coordinates of the second point
the output should be like this screenshot


Sagot :

In this way, writing the code in C++ we can say that it will be possible to make the coordinates on the planes.

Writing the code we have:

#include <iostream>

#include <cmath>

#include <iomanip>

using namespace std;

class Point{

private:

float x;

float y;

public:

Point(){

x = y = 0;

}

Point(float x, float y){

this->x = x;

this->y = y;

}

float getX(){

return x;

}

float getY(){

return y;

}

float getDistance(){

return math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2));

}

string toString(){

return "("(x1, y)","(x2, y2)")";

}

};

See more about C code at brainly.com/question/17544466

#SPJ1

View image lhmarianateixeira