コード例 #1
0
        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.GetSurface():F2}");
            Console.WriteLine($"Lateral Surface Area - {box.GetLateralSurface():F2}");
            Console.WriteLine($"Volume - {box.GetVolume():F2}");

            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            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);
                double surfaceArea    = box.GetSurface(box);
                double volume         = box.GetVolume(box);
                double lateralSurface = box.GetLateralSurface(box);

                Console.WriteLine($"Surface Area - {surfaceArea:F2}{Environment.NewLine}Lateral Surface Area - {lateralSurface:F2}{Environment.NewLine}Volume - {volume:F2}");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }