public class Point {
  public double x, y;

  public Point(double x, double y) {
    this.x = x;
    this.y = y;
  }
  // instance method
  public Point flipX() {
    Point flipped = new Point(this.x * -1, this.y);
    return flipped;
  }
  public static Point flipX(Point toFlip) {
    Point flipped = new Point(toFlip.x * -1, toFlip.y);
    return flipped;
  }

  public String toString() {
    return "(" + this.x + ", " + this.y + ")";
  }


  // Write an instance method add that takes a Point
  // and returns a new Point with the x's and y's of the
  // given Point added to this one.
  public static Point add(Point p1, Point p2) {
    return new Point(p1.x + p2.x, p1.y + p2.y);
  }
  public Point add(Point other) {
    double newx = this.x + other.x;
    double newy = this.y + other.y;
    return new Point(newx, newy);
  }

  /*
  public Point add(Point other) {
    this.x = this.x + other.x;
    this.y = this.y + other.y;
    return new Point(this.x, this.y);
  }
  public Point add(Point other) {
    this.x = this.x + other.x;
    this.y = this.y + other.y;
    return this;
  }

  */

}
