DEV/DEV2.1/random/point.java

27 lines
499 B
Java
Raw Normal View History

2023-02-01 15:30:21 +01:00
import java.awt.Point;
public class point
{
public static void main(String[] args)
{
Point[] tab =new Point[10];
int x;
int y;
for (int i = 0;i<10;i++)
{
x = (int)(Math.random()*200)-100;
y = (int)(Math.random()*200)-100;
tab[i] = new Point(x,y);
}
for (int i = 0;i<10;i++)
{
for (int j = 0;j<10;j++)
{
System.out.println("la distance entre le point "+
i+"et le point"+j+"est de:"+tab[i].distance(tab[j]));
}
System.out.println();
}
}
}