Beispiel #1
0
        public double Distance(Coordinates otherPoint)
        {
            int distanceX = Math.Abs(this.X - otherPoint.X);
            int distanceY = Math.Abs(this.Y - otherPoint.Y);

            return Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Coordinates first = new Coordinates(10, 10);
            Coordinates second = new Coordinates(13, 14);

            double distance = first.Distance(second);

            Console.WriteLine("Distance between the coordinates: {0}", distance);
        }