Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Get quick and reliable solutions to your questions from knowledgeable professionals on our comprehensive Q&A platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

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
We appreciate your time. Please revisit us for more reliable answers to any questions you may have. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.