Пример #1
0
        static void Main(string[] args)
        {
            var cityBuildings = new List <Building>();

            var OneElevenFirst = new Building("111 1st Street");

            OneElevenFirst.Stories = 10;
            OneElevenFirst.Width   = 100.50;
            OneElevenFirst.Depth   = 100.50;

            var TwoFiftySecond = new Building("250 2nd Avenue");

            TwoFiftySecond.Stories = 50;
            TwoFiftySecond.Width   = 250.25;
            TwoFiftySecond.Depth   = 150.30;

            var TenTwentyFiveMain = new Building("1025 Main Street");

            TenTwentyFiveMain.Stories = 5;
            TenTwentyFiveMain.Width   = 50.00;
            TenTwentyFiveMain.Depth   = 50.00;

            OneElevenFirst.Construct();
            TwoFiftySecond.Construct();
            TenTwentyFiveMain.Construct();

            cityBuildings.Add(OneElevenFirst);
            cityBuildings.Add(TwoFiftySecond);
            cityBuildings.Add(TenTwentyFiveMain);

            OneElevenFirst.Purchase("Joey Driscol");
            TwoFiftySecond.Purchase("Dan Storm");
            TenTwentyFiveMain.Purchase("Deep Patel");

            var Atlanta = new City("Atlanta");

            Atlanta.ElectMayor("Sean Glavin");

            foreach (Building spot in cityBuildings)
            {
                Atlanta.AddBuilding(spot);
            }

            foreach (Building structure in Atlanta.Buildings)
            {
                structure.Print();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Building FiveOneTwoEigth = new Building("512 8th Avenue");

            {
                FiveOneTwoEigth.Width   = 297.98;
                FiveOneTwoEigth.Depth   = 297.98;
                FiveOneTwoEigth.Stories = 15;
                FiveOneTwoEigth.Construct().Purchase("Me");
            };



            Building FiveOneTwoNinth = new Building("456 9th Avenue");

            {
                FiveOneTwoNinth.Width   = 297.98;
                FiveOneTwoNinth.Depth   = 456.88;
                FiveOneTwoNinth.Stories = 15;
                FiveOneTwoNinth.Construct().Purchase("Mirang Sham");
            };



            List <Building> AllBuildings = new List <Building>()
            {
                FiveOneTwoEigth,
                FiveOneTwoNinth
            };

            // Create a city
            City niallville = new City("Niallville", 1945);

            // add buildings to city
            niallville.AddBuilding(FiveOneTwoEigth);
            niallville.AddBuilding(FiveOneTwoNinth);

            // elect mayor
            niallville.ElectMayor("Wyatt Fraser");

            Console.WriteLine(niallville);
        }