import java.util.*; // given 2 points x1,y1, and x2,y2, compute the distance between them using the Euclidean distance formula: // distance = square root [(x1 - x2)^2 + (y1 - y2)^2] public class Prog2_15 { public static void main(String[] args) { Scanner in = new Scanner(System.in); // keyboard input int x1, y1, x2, y2; // the 4 values that make up the two points System.out.print("enter the first x-coordinate: "); x1 = in.nextInt(); System.out.print("enter the first y-coordinate: "); y1 = in.nextInt(); System.out.print("enter the second x-coordinate: "); x2 = in.nextInt(); System.out.print("enter the second y-coordinate: "); y2 = in.nextInt(); double distance = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2)); System.out.print("The distance between " + x1 + "," + y1 + " and " + x2 + "," + y2 + " is "); System.out.printf("%6.2f", distance); } }