예제 #1
0
    static void Main(string[] args)
    {
        // Create vegatables and attach restorants

        Cucumber cucumber = new Cucumber("Краставици", 02.10);

        cucumber.Attach(new Restorant("Одеон"));
        cucumber.Attach(new Restorant("Никол"));
        cucumber.Attach(new Restorant("Виктория"));

        Cabbage cabbage = new Cabbage("Зеле", 01.05);

        cabbage.Attach(new Restorant("Одеон"));
        cabbage.Attach(new Restorant("Никол"));
        cabbage.Attach(new Restorant("Виктория"));

        Tomato tomato = new Tomato("Домат", 01.95);

        tomato.Attach(new Restorant("Одеон"));
        tomato.Attach(new Restorant("Никол"));
        tomato.Attach(new Restorant("Виктория"));

        // Fluctuating prices will notify restorants

        cucumber.Price = 02.25;
        cucumber.Price = 02.15;
        cucumber.Price = 02.20;

        cabbage.Price = 01.10;
        cabbage.Price = 01.15;
        cabbage.Price = 01.10;

        tomato.Price = 02.10;
        tomato.Price = 02.25;
        tomato.Price = 02.20;

        // Wait for user

        Console.ReadKey();
    }