Question: 72076 6.32 (Distance Between Points) Write method distance to calculate the distance between two points (x1, y1) and (x2, y2). All numbers and return values

72076

6.32 (Distance Between Points) 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 #4: java DistanceBetweenPoints

Enterx1:12.0 Entery1:6.0 Enterx2:2.0 Entery2:2.0 Thedistancebetweenpoints(12.0,6.0)and(2.0,2.0)is10.8 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:y Enterx1:-12.2 Entery1:-13.2 Enterx2:-18.8 Entery2:-18.8 Thedistancebetweenpoints(-12.2,-13.2)and(-18.8,-18.8)is8.7 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:y Enterx1:-20.0 Entery1:-20.0 Enterx2:40.0 Entery2:40.0 Thedistancebetweenpoints(-20.0,-20.0)and(40.0,40.0)is84.9 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:y Enterx1:0.0 Entery1:0.0 Enterx2:0.0 Entery2:0.0 Thedistancebetweenpoints(0.0,0.0)and(0.0,0.0)is0.0 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:y Enterx1:-12.0 Entery1:-22.0 Enterx2:-12.0 Entery2:-22.0 Thedistancebetweenpoints(-12.0,-22.0)and(-12.0,-22.0)is0.0 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:y Enterx1:9.5 Entery1:4.6 Enterx2:10.7 Entery2:12.8 Thedistancebetweenpoints(9.5,4.6)and(10.7,12.8)is8.3 Enter'y'ifyouwanttoenteranotherpairofpoints'n'ifyoudonot:n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!