// Δραστηριότητα 5

public class RectTest5{
	public static void main(String[] args) {
		Point p1 = new Point(10,10);
		System.out.println("p1.x:" + p1.x + "\tp1.y:" + p1.y);
		Point p2 = new Point(20,20);
		System.out.println("p2.x:" + p2.x + "\tp2.y:" + p2.y);
		Point p3 = new Point(p1,p2);
		System.out.println("p3.x:" + p3.x + "\tp3.y:" + p3.y);
		p1.addpoint(p2);
		System.out.println("p1.x:" + p1.x + "\tp1.y:" + p1.y);

		Rect r1 = new Rect(10,20,30,40);
		System.out.println("r1.p1.x:" + r1.p1.x + "\tr1.p1.y:" + r1.p1.y + 
				"\tr1.p2.x:" + r1.p2.x + "\tr1.p2.y:" + r1.p2.y );
		
		Rect r2 = new Rect(p1,p2);		
		System.out.println("r2.p1.x:" + r2.p1.x + "\tr2.p1.y:" + r2.p1.y + 
					"\tr2.p2.x:" + r2.p2.x + "\tr2.p2.y:" + r2.p2.y );
		}
	}

class Point {
	public int x,y;
	public Point(int x, int y) { this.x = x; this.y = y;}
	public Point(Point p1,Point p2) { x = p1.x + p2.x; y = p1.x + p2.x; }
	public void addpoint(Point p) { // προσθέτει το σημείο p στο στιγμιότυπο που δέχεται το μήνυμα
		x += p.x;
		y += p.y;
		}
	}

class Rect {
	public Point p1, p2;
	public int x1,y1,x2,y2;
	public Rect(Point p1, Point p2) {this.p1 = new Point(p1.x,p1.y);
					this.p2 = new Point(p2.x,p2.y);}
	public Rect(int x1, int y1, int x2, int y2) {
		this.p1 = new Point(x1,y1); this.p2 = new Point(x2,y2); }

	public boolean ptinrect(Point p1) { return 1>2;}
	public void canonrect() {}
	}

