Esempio n. 1
0
        static void Main(string[] args)
        {
            Type boxType = typeof(Box);

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

            try
            {
                var boxParams = new double[3];

                for (int i = 0; i < 3; i++)
                {
                    boxParams[i] = double.Parse(Console.ReadLine());
                }

                var box = new Box(boxParams[0], boxParams[1], boxParams[2]);

                Console.WriteLine($"Surface Area - {box.GetSurfaceArea():F2}");
                Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():F2}");
                Console.WriteLine($"Volume - {box.GetVolumeArea():F2}");
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Esempio n. 2
0
        public static void Main()
        {
            Type boxType = typeof(Box);

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

            var boxParams = new double[3];

            for (int i = 0; i < boxParams.Length; i++)
            {
                boxParams[i] = double.Parse(Console.ReadLine());
            }

            try
            {
                var box = new Box(boxParams[0], boxParams[1], boxParams[2]);

                var surfaceArea        = box.GetSurfaceArea();
                var lateralSurfaceArea = box.GetLateralSurfaceArea();
                var volume             = box.GetVolume();

                Console.WriteLine($"Surface Area – {surfaceArea:f2}");
                Console.WriteLine($"Lateral Surface Area – {lateralSurfaceArea:f2}");
                Console.WriteLine($"Volume – {volume:f2}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            Type boxType = typeof(Box);

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

            var length = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());
            Box box    = null;

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

            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);

                return;
            }



            Console.WriteLine($"Surface Area - {box.GetSurfaceArea():F2}");

            Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():F2}");

            Console.WriteLine($"Volume - {box.GetVolume():F2}");
        }
Esempio n. 4
0
        static void Main()
        {
            try
            {
                Type        boxType = typeof(Box);
                FieldInfo[] fields  = boxType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
                Console.WriteLine(fields.Count());


                var length = double.Parse(Console.ReadLine());
                var width  = double.Parse(Console.ReadLine());
                var height = double.Parse(Console.ReadLine());


                var box = new Box(length, width, height);

                Console.WriteLine($"Surface Area - {box.GetSurfaceArea():F2}");
                Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():F2}");
                Console.WriteLine($"Volume - {box.GetVolume():f2}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            double length = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());

            Box box = new Box(length, width, height);

            Console.WriteLine(box.GetSurfaceArea());
            Console.WriteLine(box.GetLateralSurfaceArea());
            Console.WriteLine(box.GetVolume());
        }
        static void Main(string[] args)
        {
            double length = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double heigth = double.Parse(Console.ReadLine());

            Box box = new Box(length, width, heigth);

            Console.WriteLine($"Surface Area - {box.GetSurfaceArea():f2}");
            Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():f2}");
            Console.WriteLine($"Volume - {box.GetVolume():f2}");
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            double length = double.Parse(Console.ReadLine().Replace('.', ',')),
                   width  = double.Parse(Console.ReadLine().Replace('.', ',')),
                   height = double.Parse(Console.ReadLine().Replace('.', ','));

            var box = new Box(length, width, height);

            Console.WriteLine($"Surface Area - {box.GetSurfaceArea():0.00}");
            Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():0.00}");
            Console.WriteLine($"Volume - {box.GetVolume():0.00}");

            Console.ReadKey();
        }
Esempio n. 8
0
        public static void Main()
        {
            Type boxType = typeof(Box);

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

            double inputLength = double.Parse(Console.ReadLine());
            double inputWidth  = double.Parse(Console.ReadLine());
            double inputHeight = double.Parse(Console.ReadLine());

            Box box = new Box(inputLength, inputWidth, inputHeight);

            Console.WriteLine($"Surface Area - {box.GetSurfaceArea():F2}");
            Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():F2}");
            Console.WriteLine($"Volume - {box.GetVolume():F2}");
        }
Esempio n. 9
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.GetSurfaceArea():f2}");
                Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():f2}");
                Console.WriteLine($"Volume - {box.GetVolume():f2}");
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            try
            {
                double length = double.Parse(Console.ReadLine());
                double width  = double.Parse(Console.ReadLine());
                double height = double.Parse(Console.ReadLine());

                Box box = new Box(length, width, height);
                Console.WriteLine("Surface Area - {0:F2}", box.GetSurfaceArea());
                Console.WriteLine("Lateral Surface Area - {0:F2}", box.GetLateralSurfaceArea());
                Console.WriteLine("Volume - {0:F2}", box.GetVolume());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            var lenght = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

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

                Console.WriteLine($"Surface Area - {box.GetSurfaceArea():f2}");
                Console.WriteLine($"Lateral Surface Area - {box.GetLateralArea():f2}");
                Console.WriteLine($"Volume - {box.GetVolume():f2}");
            }
            catch (InvalidOperationException message)
            {
                Console.WriteLine(message.Message);
            }
        }
Esempio n. 12
0
        public static void Main()
        {
            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.GetSurfaceArea():F2}");
                Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurfaceArea():F2}");
                Console.WriteLine($"Volume - {box.GetVolume():F2}");
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }