Question: Write a method called distance that accepts four integer coordinates x 1 , y 1 , x 2 and y 2 as parameters and computes

Write a method called distance that accepts four integer coordinates x1, y1, x2 and y2 as parameters and computes the distance between points (x1, y1) and (x2, y2) on the Cartesian plane. The equation for the distance is

d = (x2 – 21)² + (y2 – Y1)?

For example, the call of distance(1, 0, 4, 4) would return 5.0 and the call of distance(10, 2, 3, 15) would return 14.7648230602334.

d = (x2 21) + (y2 Y1)?

Step by Step Solution

3.36 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static double distance int x1 int yl int x... View full answer

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 Building Java Programs A Back to Basics Approach Questions!