Entiers: Optimize the add and remove function:
[TP_POO.git] / TP2 / Point.java
CommitLineData
4871c009
JB
1
2class Point {
3 private double x;
4 private double y;
5
6 Point() {
7 }
8
9 Point (double x, double y) {
10 this.x = x;
11 this.y = y;
12 }
13
14 public void setX(double x) {
15 this.x = x;
16 }
17
18 public double getX() {
19 return x;
20 }
21
22 public void setY(double y) {
23 this.y = y;
24 }
25
26 public double getY() {
27 return y;
28 }
29
30 public Point additionner(Point p1) {
31 return new Point(p1.getX() + getX(), p1.getY() + getX());
32 }
33
34 public String toString() {
35 return "(" + x + "," + y + ")";
36 }
37
38}