I want to use the following formula to calculate distance between two points
How do put this into code to find the distance.
public class Point
{
public int x; // the x coordinate
public int y; // the y coordinate
public Point (int x, int y)
{
this.x=x;
this.y=y;
}
public static double distance (Point p1, Point p2)
{
// to do
return 0.0;
}
public String toString()
{
return "("+x+","+y+")";
}
}