Esempio n. 1
0
            public override void ShowPerimeter()
            {
                Point v0 = new Point();
                Point v1 = new Point();
                Point v2 = new Point();

                v0 = vertex[0];
                v1 = vertex[1];
                v2 = vertex[2];
                double ret = DisPoint.Distance(v0, v1) + DisPoint.Distance(v1, v2)
                             + DisPoint.Distance(v2, v0);

                Console.WriteLine("Perimeter is {0}", ret);
            }
Esempio n. 2
0
 public override void ShowArea()
 {
     if (input_given == false)
     {
         Console.WriteLine("Area of Triangle is 7.5 sq unit");
     }
     else
     {
         double s1, s2, s3, s, area;
         Point  v0 = new Point();
         Point  v1 = new Point();
         Point  v2 = new Point();
         v0   = vertex[0];
         v1   = vertex[1];
         v2   = vertex[2];
         s1   = DisPoint.Distance(vertex[0], vertex[1]);
         s2   = DisPoint.Distance(vertex[1], vertex[2]);
         s3   = DisPoint.Distance(vertex[2], vertex[0]);
         s    = (s1 + s2 + s3) * 0.5;
         area = s * (s - s1) * (s - s2) * (s - s3);
         Console.WriteLine("Area of Triangle is {0} sq unit", Math.Sqrt(area));
     }
 }
Esempio n. 3
0
 public override void ShowPerimeter()
 {
     Console.WriteLine("Perimeter is {0}", 2 * (DisPoint.Distance(vertex[0], vertex[2]) + DisPoint.Distance(vertex[1], vertex[3])));
 }
Esempio n. 4
0
 public override void ShowArea()
 {
     Console.WriteLine("Area is {0}", Math.Sqrt(DisPoint.Distance(vertex[0], vertex[2]) * DisPoint.Distance(vertex[1], vertex[3])));
 }