static void Main(string[] args)
        {
            try
            {
                double lenght = double.Parse(Console.ReadLine());
                double width  = double.Parse(Console.ReadLine());
                double height = double.Parse(Console.ReadLine());
                var    box    = new Box(lenght, width, height);

                var volume             = box.Volume(lenght, height, width);
                var surfaceArea        = box.Surface(lenght, height, width);
                var lateralSurfaceArea = box.LateralSurface(lenght, height, width);
                Console.WriteLine($"Surface Area - {surfaceArea:F2}");
                Console.WriteLine($"Lateral SurfaceArea - {lateralSurfaceArea:F2}");
                Console.WriteLine($"Volume - {volume:F2}");
            }
            catch (ArgumentException argEx)
            {
                Console.WriteLine(argEx.Message);
            }
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            var lenght = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

            //
            try
            {
                Box box            = new Box(lenght, width, height);
                var surfaceArea    = box.SurfaceArea();
                var surfaceLateral = box.LateralSurface();
                var volume         = box.Volume();
                Console.WriteLine($"Surface Area - {surfaceArea:f2}");
                Console.WriteLine($"Lateral Surface Area - {surfaceLateral:f2}");
                Console.WriteLine($"Volume - {volume:f2}");
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #3
0
        public static void Main()
        {
            var length = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

            Type boxType = typeof(Box);

            FieldInfo[] fields = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            try
            {
                Box box = new Box(length, width, height);
                Console.WriteLine(fields.Count());
                Console.WriteLine($"Surface Area - {box.SurfaceArea():f2}");
                Console.WriteLine($"Lateral Surface Area - {box.LeteralSurfaceArea():f2}");
                Console.WriteLine($"Volume - {box.Volume():f2}");
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(fields.Count());
                Console.WriteLine(e.Message);
            }
        }
        static void Main(string[] args)
        {
            Type boxType = typeof(Box);

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

            try
            {
                var box = new Box();
                box.Length = double.Parse(Console.ReadLine());
                box.Width  = double.Parse(Console.ReadLine());
                box.Height = double.Parse(Console.ReadLine());

                Console.WriteLine(fields.Count());
                Box.SurfaceArea(box);
                Box.LateralSurfaceArea(box);
                Box.Volume(box);
            }
            catch (Exception exc)
            {
                Console.WriteLine(fields.Count());
                Console.WriteLine(exc.Message);
            }
        }
Exemple #5
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());
            Box    box    = new Box();

            box.Lenght = lenght;
            box.Width  = width;
            box.Height = 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}");
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Box box = new Box(double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()), double.Parse(Console.ReadLine()));

            Console.WriteLine("Surface Area - {0:f2}\nLateral Surface Area - {1:f2}\nVolume - {2:f2}", box.SArea(), box.LSArea(), box.Volume());
        }