Пример #1
0
        static void Main(string[] args)
        {
            Garden myLittleGarden = new Garden();
            Flower yellowFlower   = new Flower("yellow");
            Flower blueFlower     = new Flower("blue");
            Tree   purpleTree     = new Tree("purple");
            Tree   orangeTree     = new Tree("orange");

            myLittleGarden.Plant.Add(yellowFlower);
            myLittleGarden.Plant.Add(blueFlower);
            myLittleGarden.Plant.Add(purpleTree);
            myLittleGarden.Plant.Add(orangeTree);

            Console.WriteLine(yellowFlower.NeedWater());
            Console.WriteLine(blueFlower.NeedWater());
            Console.WriteLine(purpleTree.NeedWater());
            Console.WriteLine(orangeTree.NeedWater());
            Console.WriteLine(myLittleGarden.WaterPlant(40));
            myLittleGarden.Watering(40);
            Console.WriteLine(myLittleGarden.ThroughMyGarden());
            Console.WriteLine(myLittleGarden.WaterPlant(70));
            myLittleGarden.Watering(70);
            Console.WriteLine(myLittleGarden.ThroughMyGarden());

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Water with 40
            // Show the garden again
            // Water with 70 if not enough water

            // Creating plants
            Plant yellowFlower = new Flower("yellow");
            Plant blueFlower   = new Flower("blue");
            Plant orangeTree   = new Tree("orange");
            Plant purpleTree   = new Tree("purple");

            // Creating garden
            Garden garden = new Garden();

            // Adding plants
            garden.AddToGarden(yellowFlower);
            garden.AddToGarden(blueFlower);
            garden.AddToGarden(orangeTree);
            garden.AddToGarden(purpleTree);

            // Showing garden
            garden.ShowGarden();
            garden.Watering(40);
            Console.WriteLine();
            garden.ShowGarden();
            garden.Watering(70);
            Console.WriteLine();
            garden.ShowGarden();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Garden garden = new Garden();

            garden.PrintStatus();
            garden.Watering(40);
            garden.Watering(70);

            Console.ReadLine();
        }