예제 #1
0
        static void Main(string[] args)
        {
            Type boxType = typeof(Box);

            FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            Console.WriteLine(fields.Count());

            double lenght = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());

            try
            {
                Box box = new Box(lenght, width, height);

                var lateralsurface = Box.LateralSurface(box.Lenght, box.Width, box.Height);
                var surface        = Box.SurfaceAres(box.Lenght, box.Width, box.Height);
                var volume         = Box.Volume(box.Lenght, box.Width, box.Height);

                Console.WriteLine($"Surface Area - {surface:F2}");
                Console.WriteLine($"Lateral Surface Area - {lateralsurface:F2}");
                Console.WriteLine($"Volume - {volume:F2}");
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }