Esempio n. 1
0
        public static void Main()
        {
            string input = Console.ReadLine();

            while (!input.Equals("End"))
            {
                string[] p = input.Split(' ');
                switch (p[0])
                {
                    case "Cylinder":
                        Cylinder cyl=new Cylinder(double.Parse(p[1]), double.Parse(p[2]));
                        Console.WriteLine("{0:f3}", VolumeCalculator.CalculateVolume(cyl));
                        break;
                    case "Cube":
                        Cube c= new Cube(double.Parse(p[1]));
                        Console.WriteLine("{0:f3}", VolumeCalculator.CalculateVolume(c));
                        break;
                    case "TrianglePrism":
                        TrianglePrism t= new TrianglePrism(double.Parse(p[1]), double.Parse(p[2]), double.Parse(p[3]));
                        Console.WriteLine("{0:f3}", VolumeCalculator.CalculateVolume(t));
                        break;

                }

                input = Console.ReadLine();
            }
        }
Esempio n. 2
0
        public static double CalculateCubeVolume(Cube cube)
        {
            double result = Math.Pow(cube.SideLength, 3);

            return(result);
        }
Esempio n. 3
0
 public static double CalculateVolume(Cube c)
 {
     return Math.Pow(c.sideL, 3);
 }
Esempio n. 4
0
 public static double CalculateVolume(Cube c)
 {
     return(Math.Pow(c.sideL, 3));
 }