Пример #1
0
        static void Main(string[] args)
        {
            double length = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());

            try
            {
                Box box = new Box(length, width, height);
                Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():F2}");
                Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():F2}");
                Console.WriteLine($"Volume - {box.CalculateVolume():F2}");
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var length = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

            try
            {
                var box = new Box(length, width, height);
                Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():f2}");
                Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():f2}");
                Console.WriteLine($"Volume - {box.CalculateVolume():f2}");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            double boxLength = double.Parse(Console.ReadLine());
            double boxWidth  = double.Parse(Console.ReadLine());
            double boxHeight = double.Parse(Console.ReadLine());

            try
            {
                var box = new Box(boxLength, boxWidth, boxHeight);

                Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():F2}");
                Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():F2}");
                Console.WriteLine($"Volume - {box.CalculateVolume():F2}");
            }

            catch (Exception ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Пример #4
0
        public static void Main()
        {
            double lenght = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());

            Box box = null;

            try
            {
                box = new Box(lenght, width, height);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            if (box != null)
            {
                Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea(box):F2}");
                Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea(box):F2}");
                Console.WriteLine($"Volume - {box.CalculateVolume(box):F2}");
            }
        }