コード例 #1
0
        static void Main(string[] args)
        {
            Building FiveOneTwoEighth = new Building("512 8th street")
            {
                Stories = 3,
                Width   = 5,
                Depth   = 10,
            };

            FiveOneTwoEighth.Construct();
            FiveOneTwoEighth.Purchase("Thomas Long");

            Building OneZeroTwoEasy = new Building("102 Easy Street")
            {
                Stories = 10,
                Width   = 7,
                Depth   = 8,
            };

            OneZeroTwoEasy.Construct();
            OneZeroTwoEasy.Purchase("Kristen Howton");

            City Derekville = new City("Derekville");

            Derekville.AddBuilding(FiveOneTwoEighth);
            Derekville.AddBuilding(OneZeroTwoEasy);

            foreach (Building building in Derekville.Buildings())
            {
                building.BuildingReport();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Building numberOne = new Building("512 8th Avenue")
            {
                Stories = 3,
                Width   = 45.5,
                Depth   = 30.0,
            };

            numberOne.Purchase("Joe Johnson");
            Building numberTwo = new Building("634 8th Avenue")
            {
                Stories = 5,
                Width   = 30.0,
                Depth   = 27.75,
            };

            numberTwo.Purchase("Lena Long");

            Building numberThree = new Building("818 8th Avenue")
            {
                Stories = 2,
                Width   = 75.0,
                Depth   = 145.25,
            };

            numberThree.Purchase("Derek Buckley");


            City Megalopolis = new City("Megalopolis");

            Megalopolis.addBuilding(numberOne);
            Megalopolis.addBuilding(numberTwo);
            Megalopolis.addBuilding(numberThree);

            foreach (Building building in Megalopolis.Buildings())
            {
                building.BuildingReport();
            }
            ;
        }