public static void Main(string[] args)
    {
        var command = Console.ReadLine();

        if (command == "Square")
        {
            var size = int.Parse(Console.ReadLine());
            var cor  = new CorDraw(new Square(size));
            cor.Square.Draw();
        }
        else if (command == "Rectangle")
        {
            var width  = int.Parse(Console.ReadLine());
            var height = int.Parse(Console.ReadLine());
            var cor    = new CorDraw(new Rectangle(width, height));
            cor.Rectangle.Draw();
        }
    }
Beispiel #2
0
    static void Main(string[] args)
    {
        string command = Console.ReadLine();

        if (command == "Square")
        {
            int     size = int.Parse(Console.ReadLine());
            CorDraw cor  = new CorDraw(new Square(size));
            cor.square.Draw();
        }
        else if (command == "Rectangle")
        {
            int     width  = int.Parse(Console.ReadLine());
            int     height = int.Parse(Console.ReadLine());
            CorDraw cor    = new CorDraw(new Rectangle(width, height));
            cor.rectangle.Draw();
        }
    }
    static void Main()
    {
        var shape = Console.ReadLine();

        if (shape.Equals("Rectangle"))
        {
            var width  = int.Parse(Console.ReadLine());
            var height = int.Parse(Console.ReadLine());

            var draw = new CorDraw(new Rectangle(width, height));
        }
        else
        {
            var side = int.Parse(Console.ReadLine());

            var draw = new CorDraw(new Square(side));
        }
    }
    public static void Main()
    {
        string  targetFigure = Console.ReadLine();
        int     width        = int.Parse(Console.ReadLine());
        CorDraw corDraw;

        if (targetFigure == "Rectangle")
        {
            int height = int.Parse(Console.ReadLine());
            corDraw = new CorDraw(new Rectangle(width, height));
        }
        else
        {
            corDraw = new CorDraw(new Square(width));
        }

        corDraw.DrawFigure();
    }
Beispiel #5
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());
    }
Beispiel #6
0
    static void Main()
    {
        Square squere = null;
        string type   = Console.ReadLine();

        switch (type)
        {
        case "Square":
            int x = int.Parse(Console.ReadLine());
            squere = new Square(x);
            break;

        case "Rectangle":
            int y  = int.Parse(Console.ReadLine());
            int x1 = int.Parse(Console.ReadLine());
            squere = new Rectangle(x1, y);
            break;
        }
        CorDraw draw = new CorDraw(squere);

        draw.Figure.Draw();
    }
Beispiel #7
0
    static void Main()
    {
        string shape = Console.ReadLine();
        double width = double.Parse(Console.ReadLine());

        double height = 0;

        switch (shape)
        {
        case "Square":
            height = width;
            break;

        case "Rectangle":
            height = double.Parse(Console.ReadLine());
            break;
        }

        CorDraw corDraw = new CorDraw(width, height);

        corDraw.Draw();
    }