package inherShapes;

public class Point {
	private double x;
	private double y;

	public Point(double x, double y) {
		this.x=x;
		this.y=y;
	}

	public Point(Point p) {
		this.x=p.x;
		this.y=p.y;
	}

	public void move(double dx, double dy) {
		this.x+=dx;
		this.y+=dy;
	}

	public double getX() { return x; }
	public double getY() { return y; }

	@Override public String toString() {
		return "(" + x + "," + y + ")";
	}

	@Override public boolean equals(Object obj) {
		if (!(obj instanceof Point)) return false;
		Point p = (Point) obj;
		return (p.x==this.x && p.y==this.y);
	}

	@Override public int hashCode() {
		Double xBoxed = x;
		Double yBoxed = y;
		return xBoxed.hashCode() + yBoxed.hashCode();
	}

}