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

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

                switch (command)
                {
                case Commands.createDefoult:
                {
                    var user = new User();
                    ForConsole.PrintUser(user);
                    break;
                }

                case Commands.createWithParam:
                {
                    Console.Write("Enter the first name: ");
                    var firstName = Console.ReadLine();

                    Console.Write("\nEnter the second name: ");
                    var secondName = Console.ReadLine();

                    Console.Write("\nEnter the patronimic: ");
                    var patronimic = Console.ReadLine();

                    Console.Write("\nEnter the date of birth in format dd/MM/yyyy (exmpl: 01/01/1900): ");
                    var date = ForConsole.ReadAndCheckDate();

                    var user = new User(firstName, secondName, patronimic, date);
                    ForConsole.PrintUser(user);

                    break;
                }

                case Commands.exit:
                {
                    exit = true;
                    break;
                }
                }
            }
        }
Exemple #2
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;
                }
                }
            }
        }
Exemple #3
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;
                }
                }
            }
        }