-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.java
More file actions
46 lines (41 loc) · 1.04 KB
/
Copy pathPoint.java
File metadata and controls
46 lines (41 loc) · 1.04 KB
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
46
public class Point {
public double x;
public double y;
public Point()
{
x=0;
y=0;
}
public Point (double a , double b)
{
x=a;
y=b;
}
public String toString()
{
return " ( x = "+ x +" , y = " + y + ") ";
}
public void affiche(){
System.out.println(toString());
}
//Calcul de la distance entre deux points
public double distance(Point P){
return Math.sqrt(Math.pow((x - P.y),2)+Math.pow((y-P.y),2));//Calculer la distance de P2 par rapport à P4
}
/*
public Boolean equals (Point P)
{
return (( x == P.x ) && (y == P.y));
}
*/
public void translater (int dx , int dy)
{
x=x+dx;
y=y+dy;
}
public void somme (Point P, Point p)
{
x = P.x + p.x;
y = P.y + p.y;
}
}