Question: Write a Point class, that constructs points (x,y) on any 4 quadrants of the cartesian plane. Points can be set anywhere on the plane. They

Write a Point class, that constructs points (x,y) on any 4 quadrants of the cartesian plane. Points can be set anywhere on the plane. They can also be moved by giving an x distance and y distance from the current coordinates. The following methods

int getQuadrant(); Get the quadrant (integer) that the point is in

int getX(); Get the x coordinate

int getY(); Get the y coordinate

void setPosition(int x, int y); Set the point at the given location

void movePositionBy(int x, int y); Move the point by the value of x and y

double getDistanceFrom(Point q); Get the distance of this point from another point

string toString(); : Get the string (printable) version of the object.

A point would look like (5,4). If P is at (5,4) then cout<< P.toString() would print (5,4). ie string (5,4) is returned

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!