0

Okay, so for another assignment I have to find the distance of two points. I understand how that works but for some odd reason, when the program the professor set up tests it, the numbers are way off.

This is what i have done:

```
public class Distance {
public static void main(String[] args) {
double x1=0,x2=2;
double y1=2,y2=0;
double X= Math.pow((x2-x1),2);
double Y= Math.pow((y2-y1),2);
double d = Math.sqrt(X + Y);
System.out.println("Distance is: "+d);
}
}
```

If the program tests with 2 points, my results would be like 2.8284271247461903 but the proper answer the program is expecting is 514.03. What did i miss? Could it be because of this line, `double d = Math.sqrt(X + Y);`

*Edited 2 Years Ago by <M/>*