The point is given with its and coordinates: (, ).
Two points (, ), (, ) and an integer are given. Add them.
Adding two points means to add the corresponding coordinates: (, ) + (, ) = (, ).
Adding point and a number means to add a number to both point coordinates: (, ) + = (, ).
Write the code according to the next interface:
class Point // C++
{
private:
int x, y;
public:
Point(int x = 0, int y = 0); // Constructor
void Read(void); // Read point coordinates
void Print(void); // Print point coordinates
Point operator +(int v); // Overload operator +: return the sum of point and integer v
Point operator +(Point &p); // Overload operator +: return the sum of two points
int getX(void); // Return x coordinate
int getY(void); // Return y coordinate
void SetX(int x); // Set x coordinate
void SetY(int y); // Set y coordinate
};
class Point // Java
{
private int x, y;
Point(int x, int y); // Constructor
public String toString(); // Return the string with point coordinates
public Point Add(int v); // Add to both point coordinates the value of v, return the point
public Point Add(Point p); // Add point p, return the sum of two points
public int getX(); // Return x coordinate
public int getY(); // Return y coordinate
public void SetX(int x); // Set x coordinate
public void SetY(int y); // Set y coordinate
};The first line contains the coordinates and of the first point. The second line contains the coordinates and of the second point. The third line contains an integer . All values do not exceed by the absolute value.
Print the sum of two points and a number.
Example 1