Example #1
0
        //maximal value means the highest but there are more than one.
        //maximun vakue means the highest value and all the other values are lower than him.
        //like in maths
        private static void PrintMaxZer(Zer zer)
        {
            string maxType   = "the maximum flower";
            Flower maxLength = zer.GetFlowers()[0];

            foreach (var flower in zer.GetFlowers())
            {
                if (flower.GetLength() > maxLength.GetLength())
                {
                    maxLength = flower;
                }
                if (flower.GetLength() == maxLength.GetLength() && maxLength.Equals(flower) == false)
                {
                    maxType = "the maximal flower";
                }
            }

            Console.WriteLine($"{maxType} of length : {maxLength.ToString()} ");
        }
Example #2
0
        private static void AddToZer(Zer zer)
        {
            for (int i = 0; i < Zer.GetFlowerCount(); i++)
            {
                Console.WriteLine("describe your flower\n");

                Console.WriteLine("enter name: \n");
                string name = Console.ReadLine();

                Console.WriteLine("enter length: \n");
                double length = ConfirmDouble(Console.ReadLine());

                Console.WriteLine("enter colour: \n");
                string colour = Console.ReadLine();

                Console.WriteLine("enter bloom time: \n");
                string bloomTime = Console.ReadLine();

                zer.AddFlower(new Flower(name, colour, length, bloomTime));
            }
        }