コード例 #1
0
        public static void Main()
        {
            decimal inputLength = decimal.Parse(Console.ReadLine());
            decimal inputWidth  = decimal.Parse(Console.ReadLine());
            decimal inputHeight = decimal.Parse(Console.ReadLine());

            Box box = new Box();


            Type boxType = typeof(Box);

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

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

                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("ERROR!");
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            double leght  = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());
            Box    box    = new Box(height, width, leght);

            Console.WriteLine(box.CalculateSurfaceArea());
            Console.WriteLine(box.CalculateLateralSurfaceArea());
            Console.WriteLine(box.CalculateVolume());
        }
コード例 #3
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($"Surface Area - {box.CalculateSurfaceArea():F2}" +
                              $"\nLateral Surface Area - {box.CalculateLateralSurfaceArea():F2}" +
                              $"\nVolume - {box.CalculateVolume():F2}");
        }
コード例 #4
0
        public static void Main()
        {
            Type boxType = typeof(Box);

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

            var lenght = double.Parse(Console.ReadLine());
            var widht  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

            var box = new Box(lenght, widht, height);

            Console.WriteLine($"Surface Area - {box.CalculateSurfaceArea():f2}");
            Console.WriteLine($"Lateral Surface Area - {box.CalculateLateralSurfaceArea():f2}");
            Console.WriteLine($"Volume - {box.CalculateVolume():f2}");
        }
コード例 #5
0
        private static void Main(string[] args)
        {
            var boxes = new List <Box>();

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

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

            var box = new Box();

            box.CalculateVolume(length, width, height);
            box.CalculateSurfaceArea(length, width, height);
            box.CalculateLateralSurfaceArea(length, width, height);
            boxes.Add(box);

            boxes.ForEach(x => Console.WriteLine(x));
        }
コード例 #6
0
ファイル: StartUp.cs プロジェクト: stilyssk/C-OOP
        static void Main(string[] args)
        {
            double leght  = double.Parse(Console.ReadLine());
            double width  = double.Parse(Console.ReadLine());
            double height = double.Parse(Console.ReadLine());

            try
            {
                Box box = new Box(height, width, leght);
                Console.WriteLine(box.CalculateSurfaceArea());
                Console.WriteLine(box.CalculateLateralSurfaceArea());
                Console.WriteLine(box.CalculateVolume());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #7
0
        public static void Main()
        {
            try
            {
                var length = decimal.Parse(Console.ReadLine());
                var width  = decimal.Parse(Console.ReadLine());
                var height = decimal.Parse(Console.ReadLine());

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

                Console.WriteLine(box.CalculateSurfaceArea());
                Console.WriteLine(box.CalculateLateralSurfaceArea());
                Console.WriteLine(box.CalculateVolume());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #8
0
ファイル: StartUp.cs プロジェクト: YordanDobrev97/SoftUni
        public static void Main()
        {
            var length = double.Parse(Console.ReadLine());
            var width  = double.Parse(Console.ReadLine());
            var height = double.Parse(Console.ReadLine());

            try
            {
                Box    box                = new Box(length, width, height);
                double volume             = box.CalculateVolume();
                double surfaceArea        = box.CalculateSurfaceArea();
                double lateralSurfaceArea = box.CalculateLateralSurfaceArea();

                Console.WriteLine($"Surface Area - {surfaceArea:f2}");
                Console.WriteLine($"Lateral Surface Area - {lateralSurfaceArea:f2}");
                Console.WriteLine($"Volume - {volume:f2}");
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }