Exemple #1
0
        static void Main(string[] args)
        {
            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);

            var result = new StringBuilder();

            result.AppendLine($"Surface Area - {box.CalculateSurface():F2}");
            result.AppendLine($"Lateral Surface Area - {box.CalculateLateralSurface():F2}");
            result.AppendLine($"Volume - {box.CalculateVolume():F2}");

            Console.Write(result);
        }