package class9_2_Arrays; import java.util.Scanner; public class OneDimensionalSurveyor { public static void main(String[] args) { new OneDimensionalSurveyor().run(); } public void run() { Scanner in = new Scanner(System.in); System.out.print("How many points do you want to enter?"); int numPoints = in.nextInt(); double[] positions; positions = new double[numPoints]; fillArray(positions, in); System.out.println("The minimum distance between points is: "+ minDistance(positions)); } private double minDistance(double[] positions) { double minDist = Integer.MAX_VALUE; for(int i = 0; i < positions.length; i++) { for(int j=i+1; j < positions.length; j++) { double positionI = positions[i]; double positionJ = positions[j]; double dist = Math.abs(positionI - positionJ); System.out.println("DEBUG: The distance between Point "+(i+1)+ " and Point " + (j + 1) + " is "+dist); if(dist < minDist) { minDist = dist; } } } return minDist; } public void fillArray(double[] positions, Scanner in) { for(int i = 0; i