Code cleanup.
[TP_POO.git] / TP2 / Point.java
CommitLineData
4871c009 1
78c725c5
JB
2@ClassPreamble (
3 author = "Jérôme Benoit",
4 date = "11/02/2012"
5)
4871c009
JB
6class Point {
7 private double x;
8 private double y;
9
10 Point() {
14d4fd0d 11 /*
78c725c5 12 * FIXME?: init to (0,0)
14d4fd0d 13 */
4871c009
JB
14 }
15
16 Point (double x, double y) {
17 this.x = x;
18 this.y = y;
19 }
20
21 public void setX(double x) {
22 this.x = x;
23 }
24
25 public double getX() {
26 return x;
27 }
28
29 public void setY(double y) {
30 this.y = y;
31 }
32
33 public double getY() {
34 return y;
35 }
36
14d4fd0d
JB
37 public Point additionner(Point p) {
38 Point pNew = new Point(p.getX() + getX(), p.getY() + getY());
39 return pNew;
4871c009
JB
40 }
41
42 public String toString() {
43 return "(" + x + "," + y + ")";
44 }
45
46}