Exemple #1
0
        /// <summary>
        /// Сгенерировать случайную пирамиду
        /// </summary>
        /// <returns>Случайная пирамида</returns>
        public static FigureBase GetRandomPyramid()
        {
            var pyramid = new EgyptianForce
            {
                Length = GetRandomDouble(MINVALUE, MAXVALUE, DIVIDER),
                Width  = GetRandomDouble(MINVALUE, MAXVALUE, DIVIDER),
                Height = GetRandomDouble(MINVALUE, MAXVALUE, DIVIDER)
            };

            return(pyramid);
        }
Exemple #2
0
        /// <summary>
        /// Ввод данных о пирамиде
        /// </summary>
        /// <returns>Экземпляр класса Египетская сила</returns>
        public static EgyptianForce GetNewEgyptianForceFromKeyboard()
        {
            var egyptianForce = new EgyptianForce();
            var actions       = new List <Action>()
            {
                new Action(() =>
                {
                    Console.WriteLine("Площадь основания, м: ");
                    egyptianForce.BaseArea =
                        ReadFromConsoleAndParse();
                }),
                new Action(() =>
                {
                    Console.WriteLine("Высота, м: ");
                    egyptianForce.Height =
                        ReadFromConsoleAndParse();
                }),
            };

            actions.ForEach(SetValue);
            return(egyptianForce);
        }