Esempio n. 1
0
        public static void Main(string[] args)
        {
            bool     exit = false;
            Commands command;

            while (!exit)
            {
                HelpForConsole.PrintMenu(ClassName.triangle);
                command = HelpForConsole.SetCommand();

                switch (command)
                {
                case Commands.createDefoult:
                {
                    var triangle = new Triangle();
                    ForConsole.PrintTriangle(triangle);
                    break;
                }

                case Commands.createWithParam:
                {
                    Console.Write("Enter the side a: ");
                    double a = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the side b: ");
                    double b = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the side c: ");
                    double c        = HelpForConsole.CheckAndSetParam();
                    var    triangle = new Triangle(a, b, c);
                    ForConsole.PrintTriangle(triangle);
                    break;
                }

                case Commands.exit:
                {
                    exit = true;
                    break;
                }
                }
            }
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            bool     exit = false;
            Commands command;

            while (!exit)
            {
                HelpForConsole.PrintMenu(ClassName.round);
                command = HelpForConsole.SetCommand();

                switch (command)
                {
                case Commands.createDefoult:
                {
                    var round = new Round();
                    ForConsole.PrintRound(round);
                    break;
                }

                case Commands.createWithParam:
                {
                    Console.Write("Enter the center coordinate along the X axis: ");
                    double x = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the center coordinate along the Y axis: ");
                    double y = HelpForConsole.CheckAndSetParam();
                    Console.Write("\nEnter the radius: ");
                    double radius = HelpForConsole.CheckAndSetParam();
                    var    round  = new Round(x, y, radius);
                    ForConsole.PrintRound(round);
                    break;
                }

                case Commands.exit:
                {
                    exit = true;
                    break;
                }
                }
            }
        }