java - how do i compare a double to an array of double -
how can compare array of doubles double?
in case, want go through list of miles flown each pilot , compare average of miles traveled between of them. if individual mileage greater average return true boolean.
the complier says can't compare double double[].
code:
public static boolean determine(double avgmilesflown, double[] nummilesflown) { (double : nummilesflown) { if (nummilesflown > avgmilesflown) { return true; } } }
change if (nummilesflown > avgmilesflown)
if (a > avgmilesflown)
can't directly compare number , array. need compare elements of array number. loop using assigns each individual member variable listed
you need put return false @ end in case none have flown more avg
Comments
Post a Comment