Exercise 3.9: distance
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:
For example, the call of
distance(1, 0, 4, 4) would return
5.0 and the call of
distance(10, 2, 3, 5) would return
Contacting server and running tests...
Is there a problem?
Contact a Practice-It administrator.