Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Box    Box1 = new Box(); // Declare Box1 of type Box
            Box    Box2 = new Box();
            double volume;

            // Declare Box2 of type Box
            // box 1 specification
            Box1.setLength(6.0);
            Box1.setBreadth(7.0);
            Box1.setHeight(5.0);

            // box 2 specification
            Box2.setLength(12.0);
            Box2.setBreadth(13.0);
            Box2.setHeight(10.0);

            // volume of box 1
            volume = Box1.getVolume();
            Console.WriteLine("Volume of Box1 : {0}", volume);

            // volume of box 2
            volume = Box2.getVolume();
            Console.WriteLine("Volume of Box2 : {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            /*Declare variables*/
            Box    Box1 = new Box();
            Box    Box2 = new Box();
            double volume;

            // Box1 Specs
            Box1.setHeight(5.0);
            Box1.setLength(6.0);
            Box1.setBreadth(7.0);

            // Box2 Specs
            Box2.setHeight(10.0);
            Box2.setLength(12.0);
            Box2.setBreadth(13.0);

            // Volume of Box1
            volume = Box1.getVolume();
            Console.WriteLine("Volume of Box1 : {0}", volume);

            // Volume of Box1
            volume = Box2.getVolume();
            Console.WriteLine("Volume of Box2 : {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Box    Box1 = new Box();     // 声明 Box1,类型为 Box
            Box    Box2 = new Box();     // 声明 Box2,类型为 Box
            double volume;               // 体积


            // Box1 详述
            Box1.setLength(6.0);
            Box1.setBreadth(7.0);
            Box1.setHeight(5.0);

            // Box2 详述
            Box2.setLength(12.0);
            Box2.setBreadth(13.0);
            Box2.setHeight(10.0);

            // Box1 的体积
            volume = Box1.getVolume();
            Console.WriteLine("Box1 的体积: {0}", volume);

            // Box2 的体积
            volume = Box2.getVolume();
            Console.WriteLine("Box2 的体积: {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            /*Declare variables*/
            Box Box1 = new Box();
            Box Box2 = new Box();
            double volume;

            // Box1 Specs
            Box1.setHeight(5.0);
            Box1.setLength(6.0);
            Box1.setBreadth(7.0);

            // Box2 Specs
            Box2.setHeight(10.0);
            Box2.setLength(12.0);
            Box2.setBreadth(13.0);

            // Volume of Box1
            volume = Box1.getVolume();
            Console.WriteLine("Volume of Box1 : {0}", volume);

            // Volume of Box1
            volume = Box2.getVolume();
            Console.WriteLine("Volume of Box2 : {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Box Box1 = new Box();   //声明Box1,类型为Box
            Box Box2 = new Box();   //声明Box2,类型为Box
            double volume;          //体积

            //Box1详述
            Box1.setLength(6.0);
            Box1.setBreadth(7.0);
            Box1.setHeight(5.0);

            //Box2详述
            Box2.setLength(12.0);
            Box2.setBreadth(13.0);
            Box2.setHeight(10.0);

            //Box1的体积
            volume = Box1.getVolume();
            Console.WriteLine("Box1 的体积: {0}" ,volume);

            //Box2的体积
            volume = Box2.getVolume();
            Console.WriteLine("Box2 的体积: {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Box b1 = new Box();
            Box b2 = new Box();

            b1.setLength(6.0);
            b1.setBreadth(7.0);
            b1.setHeight(5.0);

            b2.setLength(12.0);
            b2.setBreadth(13.0);
            b2.setHeight(10.0);

            Console.WriteLine("Box1的体积:{0}", b1.getVolume());
            Console.WriteLine("Box2的体积:{0}", b2.getVolume());
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Box box1 = new Box();
            Box box2 = new Box();

            box1.setLength(5.0);
            box1.setBreadth(6.0);
            box1.setHeight(7.0);

            box2.setLength(10.0);
            box2.setBreadth(11.0);
            box2.setHeight(12.0);

            Console.WriteLine("box1's volume: {0}", box1.getVolume());
            Console.WriteLine("box2's volume: {0}", box2.getVolume());
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Box Box1 = new Box(5, 5, 7); // Declare Box1 of type Box

            double volume = 0.0;         // Store the volume of a box here

            // volume of box 1
            volume = Box1.getHeight() * Box1.getLength() * Box1.getBreadth();
            Console.WriteLine("Volume of Box1 : {0}", volume);


            //update the height

            Box1.setHeight(10);
            volume = Box1.getHeight() * Box1.getLength() * Box1.getBreadth();
            Console.WriteLine("Update the volume of Box1 : {0}", volume);

            Console.ReadKey();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Box    Box1 = new Box(); // Declare Box1 of type Box
            Box    Box2 = new Box();
            double volume;

            Console.WriteLine("Enter the Specifications of Two Box");
            // Declare Box2 of type Box
            // box 1 specification
            double L1 = Convert.ToDouble(Console.ReadLine());
            double B1 = Convert.ToDouble(Console.ReadLine());
            double H1 = Convert.ToDouble(Console.ReadLine());

            Box1.setLength(L1);
            Box1.setBreadth(B1);
            Box1.setHeight(H1);

            // box 2 specification
            double L2 = Convert.ToDouble(Console.ReadLine());
            double B2 = Convert.ToDouble(Console.ReadLine());
            double H2 = Convert.ToDouble(Console.ReadLine());

            Box2.setLength(L2);
            Box2.setBreadth(B2);
            Box2.setHeight(H2);

            // volume of box 1
            volume = Box1.getVolume();
            Console.WriteLine("Volume of Box1 : {0}", volume);

            // volume of box 2
            volume = Box2.getVolume();
            Console.WriteLine("Volume of Box2 : {0}", volume);

            Console.ReadKey();
        }