Question: IN JAVA Write method distance to calculate the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of

IN JAVA
Write method distance to calculate the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of type double . Incorporate this method into an application that enables the user to enter the coordinates of the points and get the distance. The user should be asked whether she wants to enter another set of points or terminate the program. SAMPLE RUN : java DistanceBetween Points Enter x1:12.0 Enter y1:6.0 Enter x2:2.0 Enter y2:2.0 The distance between points (12.0,6.0) and (2.0,2.0) is 10.8 Enter 'y' if you want to enter another pair of points 'n' if you do not:y Enter x1:-12.2 Enter y1:-13.2 Enter x2:-18.8 Enter y2:-18.8 The distance between points (-12.2,-13.2) and (-18.8,-18.8) is 8.7 Enter 'y' if you want to enter another pair of points 'n' if you do not:y Enter x1:-20.0 Enter y1:-20.0 Enter x2:40.0 Enter y2:40.0 The distance between points (-20.0,-20.0) and (40.0,40.0) is 84.9 Enter 'y' if you want to enter another pair of points 'n' if you do not:y Enter x1:0.0 Enter y1:0.0 Enter x2:0.0 Enter y2:0.0 The distance between points (0.0,0.0) and (0.0,0.0) is 0.0 Enter 'y' if you want to enter another pair of points 'n' if you do not:y Enter x1:-12.0 Enter y1:-22.0 Enter x2:-12.0 Enter y2:-22.0 The distance between points (-12.0,-22.0) and (-12.0,-22.0) is 0.0 Enter 'y' if you want to enter another pair of points 'n' if you do not:y Enter x1:9.5 Enter y1:4.6 Enter x2:10.7 Enter y2:12.8 The distance between points (9.5,4.6) and (10.7,12.8) is 8.3 Enter 'y' if you want to enter another pair of points 'n' if you do not:n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
