Exemple #1
0
        static void Main(string[] args)
        {
            Cat cat1 = new Cat(" Leo", "Male", 30, 100, 75);
            Cat cat2 = new Cat(" Gracie", "Female", 40, 110, 90);
            Cat cat3 = new Cat(" Stella", "Female", 50, 90, 60);

            cat1.ShowData();
            cat2.ShowData();
            cat3.ShowData();
            CatHouse house1 = new CatHouse(" Happy Cats House");
            CatHouse house2 = new CatHouse(" Leo's Place");
            CatHouse house3 = new CatHouse(" Haunted House of Cats");


            //////////////////////////ADDING//////////////////////
            house1.AddCat(ref cat1);
            house2.AddCat(ref cat2);
            house3.AddCat(ref cat3);
            /////////////////////////////////////////////////////
            house1.Show();
            house2.Show();
            house3.Show();
            //////////////////////////CATS///////////////////////
            house1.ShowCats();
            house2.ShowCats();
            house3.ShowCats();

            PetShop shop = new PetShop();

            ///////////////////////PETSHOP///////////////////////

            shop.AddCatHouse(ref house1);
            shop.AddCatHouse(ref house2);
            shop.AddCatHouse(ref house3);
            /////////////////////////////////////////////////////


            shop.ShowHouses();

            ////////////////////////ACTIONS//////////////////////
            cat1.GoEating();
            cat1.GoPlaying();
            cat1.GoSleeping();

            //-------------------//

            cat2.GoPlaying();
            cat2.GoEating();
            cat2.GoSleeping();

            //-------------------//

            cat3.GoSleeping();
            cat3.GoPlaying();
            cat3.GoEating();

            /////////////////////////////////////////////////////////////////////////////////////////////////////////////
        }
Exemple #2
0
        public void AddCatHouse(ref CatHouse house)
        {
            System.Threading.Thread.Sleep(999);

            CatHouse[] temp = new CatHouse[++CatHouseCount];
            if (Houses != null)
            {
                Houses.CopyTo(temp, 0);
            }
            temp[temp.Length - 1] = house;
            Houses = temp;
        }