示例#1
0
        public static void Main()
        {
            Shape shape;
            var   input = Console.ReadLine();

            if (input == "Square")
            {
                shape = new Square(int.Parse(Console.ReadLine()));
            }
            else
            {
                shape = new Rectangle(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
            }

            var corDraw = new CorDraw(shape);

            corDraw.Draw();
        }
示例#2
0
        public static void Main()
        {
            var   shapeType = Console.ReadLine();
            Shape shape;

            if (shapeType == "Square")
            {
                var side = int.Parse(Console.ReadLine());
                shape = new Square(side);
            }
            else
            {
                var width  = int.Parse(Console.ReadLine());
                var length = int.Parse(Console.ReadLine());
                shape = new Rectangle(width, length);
            }

            var drawer = new CorDraw(shape);
        }
示例#3
0
        public static void Main()
        {
            var    shape = Console.ReadLine();
            var    width = double.Parse(Console.ReadLine());
            double height;

            if (shape == "Square")
            {
                height = width;
            }
            else
            {
                height = double.Parse(Console.ReadLine());
            }

            var figure = new CorDraw(width, height);

            Console.WriteLine(figure.Draw());
        }
示例#4
0
            static void Main(string[] args)
            {
                string input = Console.ReadLine();
                Figure figure;

                switch (input)
                {
                case "Square":
                    int size = int.Parse(Console.ReadLine());
                    figure = new Square(size, size);
                    CorDraw drawFig = new CorDraw(figure);
                    drawFig.drawFigure();
                    break;

                case "Rectangle":
                    int sizeA = int.Parse(Console.ReadLine());
                    int sizeB = int.Parse(Console.ReadLine());
                    figure = new Rectangle(sizeA, sizeB);
                    CorDraw drawFg = new CorDraw(figure);
                    drawFg.drawFigure();
                    break;
                }
            }
示例#5
0
        static void Main(string[] args)
        {
            var figure = Console.ReadLine();
            CorDraw corDraw;

            switch (figure)
            {
                case "Square":
                    var size = int.Parse(Console.ReadLine());
                    var square = new Square(size);
                    corDraw = new CorDraw(square);
                    break;
                case "Rectangle":
                    var width = int.Parse(Console.ReadLine());
                    var height = int.Parse(Console.ReadLine());
                    var rectangle = new Rectangle(width, height);
                    corDraw = new CorDraw(rectangle);
                    break;
                default:
                    throw new ArgumentException();
            }

            corDraw.DrawFigure();
        }
示例#6
0
 static void Main(string[] args)
 {
     string input = Console.ReadLine();
     Figure figure;
     switch(input)
     {
         case "Square":
             int size = int.Parse(Console.ReadLine());
              figure = new Square(size, size);
             CorDraw drawFig = new CorDraw(figure);
             drawFig.drawFigure();
             break;
         case "Rectangle":
             int sizeA = int.Parse(Console.ReadLine());
             int sizeB = int.Parse(Console.ReadLine());
              figure = new Rectangle(sizeA, sizeB);
             CorDraw drawFg = new CorDraw(figure);
             drawFg.drawFigure();
             break;
     }
 }