Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            MyCircle myCircleA = new MyCircle(new MyPoint(4, 5), 4);
            MyCircle myCircleB = new MyCircle(new MyPoint(5, 8), 4);

            Console.WriteLine("hinh tron 1: ");
            Console.WriteLine(myCircleA.toString());

            Console.WriteLine("hinh tron 2: ");
            Console.WriteLine(myCircleB.toString());

            Console.Write("Khoang cach giua hinh tron 1 va 2 la:  ");
            Console.Write(myCircleA.distance(myCircleB));


            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public double distance(MyCircle another)
        {
            double result = Math.Sqrt(Math.Pow((another.center.X - this.center.X), 2) + Math.Pow((another.center.Y - this.center.Y), 2));

            return(result);
        }