public static void Main() { NoSensor sensor = new NoSensor(1, 30, 40, 20, 80); NoSensor sensorOutro = new NoSensor(2, 60, 120, 50, 20); Console.WriteLine("A distancia : " + sensor.Distancia(sensorOutro)); }
public double Distancia(NoSensor sensorOutro) { return(Math.Sqrt(Math.Pow(this.getLatitude() - sensorOutro.Latitude, 2.0) + Math.Pow(this.getLongitude() - sensorOutro.Longitude, 2.0) + Math.Pow(this.getNivel() - sensorOutro.Nivel, 2.0))); }