logo CodeStepByStep logo

computeDistance

Language/Type: Java parameters Math
Related Links:

Write a method named computeDistance 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 formula for the distance between two points is:

distance equation

For example, the call of computeDistance(10, 2, 3, 5) would return 7.615773105863909.

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.