コード例 #1
0
        static void Main(string[] args)
        {
            var garden = new Garden();

            garden.PlantFlower("yellow", 4);
            garden.PlantFlower("blue", 8);
            garden.PlantTree("purple", 4);
            garden.PlantTree("orange", 20);

            Console.WriteLine(garden.PrintHowManyThirstyPlants());

            garden.DaysHasPassed(4);
            Console.WriteLine();

            Console.WriteLine(garden.PrintHowManyThirstyPlants());
            Console.WriteLine( );


            garden.WateringTheGarden(20f);
            Console.WriteLine(garden.PrintHowManyThirstyPlants());

            garden.PrintInfo();

            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var garden = new Garden("kertecske");

            var flower1 = new Flower(3);
            var flower2 = new Flower(0);
            var tree1   = new Tree(2);
            var tree2   = new Tree(1);

            garden.AddPlant(flower1);
            garden.AddPlant(flower2);
            garden.AddPlant(tree1);
            garden.AddPlant(tree2);


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

            Console.ReadLine();
        }