示例#1
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();
        }
示例#2
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();
        }
示例#3
0
        static void Main(string[] args)
        {
            Garden garden = new Garden();

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

            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            Garden myGarden = new Garden("My oasis of peace");

            myGarden.Add(new Flower("yellow"));
            myGarden.Add(new Flower("blue"));
            myGarden.Add(new Tree("purple"));
            myGarden.Add(new Tree("orange"));

            myGarden.Info();
            myGarden.WaterGarden(40);
            myGarden.WaterGarden(70);
        }
示例#5
0
        static void Main(string[] args)
        {
            var flowerAndTreeGarden = new Garden();

            var yellowFlower = new Flower("yellow");
            var blueFlower   = new Flower("blue");
            var purpleTree   = new Tree("purple");
            var orangeTree   = new Tree("orange");

            flowerAndTreeGarden.PlantGarden(yellowFlower);
            flowerAndTreeGarden.PlantGarden(blueFlower);
            flowerAndTreeGarden.PlantGarden(purpleTree);
            flowerAndTreeGarden.PlantGarden(orangeTree);

            flowerAndTreeGarden.GardenInfo();
            Console.WriteLine();
            flowerAndTreeGarden.WaterGarden(40);
            Console.WriteLine();
            flowerAndTreeGarden.WaterGarden(70);
        }
示例#6
0
        static void Main(string[] args)
        {
            Garden myGarden = new Garden();

            Plant blue   = new Flower("Blue");
            Plant yellow = new Flower("Yellow");
            Plant purple = new Tree("Purple");
            Plant orange = new Tree("Tree");

            myGarden.AddPlant(blue);
            myGarden.AddPlant(yellow);
            myGarden.AddPlant(purple);
            myGarden.AddPlant(orange);

            myGarden.PrintAll();
            Console.WriteLine();

            myGarden.WaterGarden(40);
            myGarden.PrintAll();
            Console.WriteLine();

            myGarden.WaterGarden(70);
            myGarden.PrintAll();
        }
 static void Main(string[] args)
 {
     var garden = new Garden();
 }