public class Util {
public static double getDistance(int x1, int y1, int x2, int y2) {
double x = (x2 - x1);
double y = (y2 - y1);
double w = Math.pow(x, 2);
double u = Math.pow(y, 2);
double r = w - u;
int y = Math.sqrt(r);
}
Any hints What to add here?
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
horst
12 January 2020, 11:14
As far as I can see, you are incredibly close and only one single arithmetic operator is doing the "wrong" thing. Just look at your code again and keep in mind that you are looking for the "c" in a²+b²=c²
(PS: On a syntactical level, there is no reason to switch back to Integer for the return-statement. On the contrary, the signature of the method demands a double output, so your last two lines should look something like
0