public void DecidingMethod( )
        {
            int choice;

            do
            {
                choice = Display();
                switch (choice)
                {
                case 1:
                    Triangle tri = ShapeOp.DisplayForTri();
                    tri.CalculateArea();
                    Console.WriteLine("\nArea of a triangle with base {0} and height {1}: {2}", tri.BaseT, tri.Height, tri.Area);

                    break;

                case 2:
                    Rectangle rec = ShapeOp.DisplayForRec();
                    rec.CalculateArea();
                    Console.WriteLine("\nArea of a rectangle with breadth {0} and length {1}: {2}", rec.Breadth, rec.Length, rec.Area);

                    break;

                case 3:
                    Circle cir = ShapeOp.DisplayForCir();
                    cir.CalculateArea();
                    Console.WriteLine("\nArea of a circle with radius {0} : {1}", cir.Radius, cir.Area);

                    break;

                default:
                    Console.WriteLine("-----------Choice should be between 1 and 3-------------");
                    break;
                }
            } while (Validation.RangeValidation(choice, 1, 3));
        }
Example #2
0
        public static void Main()
        {
            ShapeOp so = new ShapeOp();

            so.DecidingMethod();
        }