-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path32_Point.java
More file actions
45 lines (33 loc) · 863 Bytes
/
32_Point.java
File metadata and controls
45 lines (33 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public class Point {
private int x;
private int y;
public Point() {
}
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public double distance() {
return Math.sqrt((this.x * this.x) + (this.y * this.y));
}
public double distance(int x, int y) {
return Math.sqrt((this.x - x)*(this.x - x) + (this.y - y)*(this.y - y));
}
public double distance(Point point) {
int x = point.getX();
int y = point.getY();
return Math.sqrt((this.x - x)*(this.x - x) + (this.y - y)*(this.y - y));
}
}