Initial code for the TP2.
[TP_POO.git] / TP2 / Point.java
diff --git a/TP2/Point.java b/TP2/Point.java
new file mode 100644 (file)
index 0000000..e949acc
--- /dev/null
@@ -0,0 +1,38 @@
+
+class Point {
+    private double x;
+    private double y;
+
+    Point() {
+    }
+
+    Point (double x, double y) {
+        this.x = x;
+        this.y = y;
+    }
+
+    public void setX(double x) {
+        this.x = x;
+    }
+
+    public double getX() {
+        return x;
+    }
+
+    public void setY(double y) {
+        this.y = y;
+    }
+
+    public double getY() {
+        return y;
+    }
+
+    public Point additionner(Point p1) {
+        return new Point(p1.getX() + getX(), p1.getY() + getX());
+    }
+
+    public String toString() {
+        return "(" + x + "," + y + ")";
+    }
+
+}