logo CodeStepByStep logo

ComputeDistance

Language/Type: C# parameters Math

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 C# 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.