Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Apple  apple  = new Apple(false, "red");
            Orange orange = new Orange(3.4f);
            Banana banana = new Banana(true, false, 2.5f);
            Grapes grapes = new Grapes(false, "green");

            Fruit[] fruit = new Fruit[4] {
                apple, orange, banana, grapes
            };
            FruitSalad fruitSalad = new FruitSalad(fruit);

            PrintAppleColor(apple);
            printBananaSize(banana);
            PrintCalories(fruitSalad);
            IsMyFavorite(fruitSalad);
            FruitSalad fruitSaladFromFun = createSalad(fruit);

            Console.WriteLine(fruitSalad.ToString());

            Console.ReadLine();
        }
Exemplo n.º 2
0
 private static void PrintCalories(FruitSalad fruitSalad)
 {
     Console.WriteLine($"Total Calories: {fruitSalad.GetTotalCalories()}");
 }
Exemplo n.º 3
0
 private static void IsMyFavorite(FruitSalad fruitSalad)
 {
     Console.WriteLine($"Contain My Favorite Fruit? {fruitSalad.ContainMyFavoriteFruit()}");
 }