コード例 #1
0
        static void Main(string[] args)
        {
            var input  = Console.ReadLine();
            int width  = 0;
            int height = 0;

            Square square = null;

            switch (input)
            {
            case "Square":
                width  = int.Parse(Console.ReadLine());
                square = new Square(width);
                break;

            case "Rectangle":
                width  = int.Parse(Console.ReadLine());
                height = int.Parse(Console.ReadLine());
                square = new Rectangle(width, height);
                break;

            default:
                break;
            }

            CorDraw corDraw = new CorDraw(square);

            corDraw.Figure.Draw();
        }
コード例 #2
0
        public static void Main()
        {
            var figureType = Console.ReadLine();

            switch (figureType)
            {
            case "Square":
                var square = new Square(int.Parse(Console.ReadLine()));
                CorDraw.DrawFigure(square);
                break;

            case "Rectangle":
                var rectangle = new Rectangle(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()));
                CorDraw.DrawFigure(rectangle);
                break;
            }
        }
コード例 #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)
        {
            var vigure = Console.ReadLine();
            var sizes  = int.Parse(Console.ReadLine());

            if (vigure == "Square")
            {
                var figure = new Square(sizes);
                var drawer = new CorDraw(figure);
                drawer.Draw();
            }
            else
            {
                var height = int.Parse(Console.ReadLine());
                var figure = new Rectangle(sizes, height);
                var drawer = new CorDraw(figure);
                drawer.Draw();
            }
        }