java - Expression must be an array, but ... to double -
i trying practice writing code , can't solve problem here. keep getting "double sidea,sideb,sidec" expression must array, resolved double.
public static double calculate (double array1, double array2, double array3) { double sidea = math.sqrt(((array2[0]-array3[0])^2)+((array2[1]-array3[1])^2)+((array2[2]-array3[2])^2)); double a= math.abs(sidea); double sideb = math.sqrt(((array1[0]-array3[0])^2)+((array1[1]-array3[1])^2)+((array1[2]-array3[2])^2)); double b= math.abs(sideb); double sidec = math.sqrt(((array2[0]-array1[0])^2)+((array2[1]-array1[1])^2)+((array2[2]-array1[2])^2)); double c= math.abs(sidec); double s = ((0.5) * (a + b + c)); return math.sqrt(s * (s - a) * (s - b) * (s - c)); } so can please help?
array1, despite name, not array you've written code right now. you've written it, array1 single number.
instead, should
public static double calculate(double[] array1, double[] array2, double[] array3) { (also, ^ not think does; need math.pow. on other hand, can write math.hypot(array2[0] - array1[0], array2[1] - array1[1]).)
Comments
Post a Comment