コード例 #1
0
        public static void Main(string[] args)
        {
            Garden myGarden = new Garden();
            Flower flower1  = new Flower("yellow");

            myGarden.PlantAdder(flower1);
            Flower flower2 = new Flower("green");

            myGarden.PlantAdder(flower2);
            Tree tree1 = new Tree("grey");

            myGarden.PlantAdder(tree1);
            Tree tree2 = new Tree("pink");

            myGarden.PlantAdder(tree2);

            myGarden.ThristyCheck();
            Console.WriteLine();

            myGarden.Watering(40);
            myGarden.ThristyCheck();
            Console.WriteLine();

            myGarden.Watering(70);
            myGarden.ThristyCheck();
            Console.WriteLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: CsKriszta93/4.week
        static void Main(string[] args)
        {
            var garden  = new Garden();
            var flower  = new Flower("yellow");
            var flower2 = new Flower("blue");
            var tree    = new Tree("purple");
            var tree2   = new Tree("orange");

            garden.plants.Add(flower);
            garden.plants.Add(tree);
            garden.plants.Add(flower2);
            garden.plants.Add(tree2);

            garden.StateOfGarden();
            Console.WriteLine();
            garden.Watering(40);
            Console.WriteLine();
            garden.StateOfGarden();
            Console.WriteLine();
            garden.Watering(70);
            Console.WriteLine();
            garden.StateOfGarden();
            Console.ReadLine();
        }