Question: import java.util.Scanner: public class Distance { public static void main(String [] args) { ystem.out.println(Enter 4 real numbers for x1, y1, x2, y2): double x1, x2,
import java.util.Scanner: public class Distance { public static void main(String [] args) { ystem.out.println("Enter 4 real numbers for x1, y1, x2, y2"): double x1, x2, y1, y2: Scanner sc = new Scanner(System.in): x1 = Double.parseDouble(sc.next): y1 = Double.parseDouble(sc.next) x2 = Double.parseDouble(sc.next): y2 = Double. parseDouble(sc.next): double dist Math. squareroot (Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)) double m1, m2: ml = (x1 + x2)/2.0: m2 (y1 +y2)/2.0: System.out.println("Points: "+(Math.round(x1*10.0)/ 10.0) + ", " + Math.round(y1*10.0)/10.0") + System.out.println("Distance: "+(Math.round(dist 10.0)/10.0)): (Math.round(x2 10.0)/10.0)+)+ ", " + (Math.round(y2 10.0/10.0)+) "): System.out printin("Distance" + (Math.round(dist*10.0)/10.0);System.out printin("Midpoint" + (Math.round(dist*10.0)/10.0): } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
