예제 #1
0
파일: Program.cs 프로젝트: AStr347/Patterns
        static void Main(string[] args)
        {
            Menu pancakeHouseMenu = new Menu("PancakeHouse", "Breakfast");
            Menu dinerMenu        = new Menu("DINER MENU", "Lunch");
            Menu AllMenu          = new Menu("ALL MENU", "ALL");

            AllMenu.Add(pancakeHouseMenu);
            AllMenu.Add(dinerMenu);

            Waitress waitress = new Waitress(AllMenu);


            pancakeHouseMenu.Add(new MenuItem("K & B's Pancake Breakfast",
                                              "Pancakes with scrambled eggs, and toast",
                                              true,
                                              2.99));
            pancakeHouseMenu.Add(new MenuItem("Regular Pancake Breakfast",
                                              "Pancakes with fried eggs, sausage",
                                              false,
                                              2.99));
            pancakeHouseMenu.Add(new MenuItem("Blueberry Pancakes",
                                              "Pancakes made with fresh blueberries",
                                              true,
                                              3.49));
            pancakeHouseMenu.Add(new MenuItem("Waffles",
                                              "Waffles, with your choice of blueberries or strawberries",
                                              true,
                                              3.59));

            dinerMenu.Add(new MenuItem("Vegetarian BLT",
                                       "(Fakin’) Bacon with lettuce & tomato on whole wheat",
                                       true, 2.99));
            dinerMenu.Add(new MenuItem("BLT",
                                       "Bacon with lettuce & tomato on whole wheat",
                                       false, 2.99));
            dinerMenu.Add(new MenuItem("Soup of the day",
                                       "Soup of the day, with a side of potato salad",
                                       false, 3.29));
            dinerMenu.Add(new MenuItem("Hotdog",
                                       "A hot dog, with saurkraut, relish, onions, topped with cheese",
                                       false, 3.05));

            waitress.PrintMenu();
            Console.WriteLine("\n\n");
            waitress.PrintVegetarian();
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Waitress waitress = new Waitress(new PancadeHouseMenu(), new DinerMenu());

            waitress.PrintMenu();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("====== Alcohol Shop =====");
            Console.WriteLine();

            var pesho   = new Client("Pesho", "Petrov", 21);
            var gosho   = new Client("Gosho", "Goshov", 18);
            var mariika = new Client("Mariika", "Petrova", 25);
            var canko   = new Client("Canko", "Mitkov", 36);
            var mitko   = new Client("Mitko", "Mitkov", 52);
            var goshka  = new Client("Goshka", "Mitkova", 50);

            var firstClients = new List <Client>();

            firstClients.Add(pesho);
            firstClients.Add(gosho);
            firstClients.Add(mariika);

            var secondClients = new List <Client>();

            secondClients.Add(canko);
            secondClients.Add(mitko);
            secondClients.Add(goshka);

            var waitressPenka = new Waitress("Penka", "Penkova", 35);
            var waitressSuzi  = new Waitress("Suzi", "Avramova", 30);

            var waitresses = new List <Waitress>();

            waitresses.Add(waitressPenka);
            waitresses.Add(waitressSuzi);

            var table1 = new Table(3, firstClients, "Table 1");

            table1.Waitress = waitressPenka;
            Console.WriteLine($"Avanti's table 1 waitress is {table1.Waitress.FirstName}.");
            table1.GetClientsNames(table1.Name);
            Console.WriteLine();

            var table2 = new Table(3, secondClients, "Table 2");

            table2.Waitress = waitressSuzi;
            Console.WriteLine($"Avanti's table 2 waitress is {table2.Waitress.FirstName}.");
            table2.GetClientsNames(table2.Name);
            Console.WriteLine();

            var tables = new List <Table>();

            tables.Add(table1);
            tables.Add(table2);

            var fridgeSamsung = new Fridge("Fridge Samsung", 4, true);

            fridgeSamsung.PushButtonOn(fridgeSamsung.Name);
            fridgeSamsung.PushButtonOff(fridgeSamsung.Name);
            fridgeSamsung.PushButtonOn(fridgeSamsung.Name);
            fridgeSamsung.ChangeDegree(true, fridgeSamsung);
            Console.WriteLine();

            var alcoholShop = new AlcoholShop("Avanti", tables, waitresses, fridgeSamsung);
            var avantiLtd   = new Company("Avanti LTD");

            alcoholShop.Company = avantiLtd;
            Console.WriteLine("Alcohol shop company's name is " + alcoholShop.Company.Name + '.');
            Console.WriteLine();

            var adressAlcoholShop = new Address("Sofia", "Lincoln street");

            alcoholShop.Address = adressAlcoholShop;
            Console.WriteLine($"Alcohol shop's address is {alcoholShop.Address.City}, {alcoholShop.Address.Street}.");
            Console.WriteLine();

            var vodka   = new Alcohol("Vodka", 25);
            var whiskey = new Alcohol("Whiskey", 159);
            var beer    = new Alcohol("Beer", 2);
            var candy   = new Candy("Bonbon", 5);

            alcoholShop.AddGood(candy);
            alcoholShop.AddGood(vodka);
            alcoholShop.AddGood(whiskey);
            alcoholShop.AddGood(beer);

            Console.WriteLine($"In {alcoholShop.Name}'s income before ---> {alcoholShop.Income} lv. " +
                              $"Count: {alcoholShop.Goods.Count()}");

            alcoholShop.Sell(beer);

            Console.WriteLine($"In {alcoholShop.Name}'s income after ---> {alcoholShop.Income} lv. " +
                              $"Count: {alcoholShop.Goods.Count()}");
            Console.WriteLine();

            Console.WriteLine("====== Candy Shop =====");

            var sellerCandyShop = new Seller("Ani", "Petkova", 21);

            sellerCandyShop.Sallary = 750;

            var airConditionerDaikin = new AirConditioner("Air conditioner  Daikin", 23, false, "purple");

            var candyShop = new CandyShop(sellerCandyShop, airConditionerDaikin);

            Console.WriteLine();

            var candyLtd = new Company("Candy LTD");

            candyShop.Company = candyLtd;

            var addressCandyShop = new Address("Sofia", "Lublyana street");

            candyShop.Address = addressCandyShop;
            Console.WriteLine($"The address of {candyShop.Company.Name} is {candyShop.Address.City}, {candyShop.Address.Street}.");

            airConditionerDaikin.PushButtonOn(airConditionerDaikin.Name);
            airConditionerDaikin.PushButtonOff(airConditionerDaikin.Name);
            airConditionerDaikin.PushButtonOn(airConditionerDaikin.Name);
            airConditionerDaikin.ChangeDegree(false, airConditionerDaikin);
            Console.WriteLine();

            var chocolate      = new Candy("Chocolate", 1.8m);
            var candyBar       = new Candy("Candy bar", 1.5m);
            var sweet          = new Candy("Sweet", 2.5m);
            var expensiveSweet = new Candy("ExpensiveSweet", 25);

            candyShop.AddGood(chocolate);
            candyShop.AddGood(candy);
            candyShop.AddGood(candyBar);
            candyShop.AddGood(sweet);
            candyShop.AddGood(beer);
            candyShop.AddGood(expensiveSweet);

            Console.WriteLine($"In {candyShop.Company.Name}'s income before ---> {candyShop.Income} lv. " +
                              $"Count: {candyShop.Goods.Count()}");
            candyShop.Sell(chocolate);
            Console.WriteLine($"In {candyShop.Company.Name}'s income after ---> {candyShop.Income} lv. " +
                              $"Count: {candyShop.Goods.Count()}");
            Console.WriteLine();

            sellerCandyShop.GetBonus(candyShop);
            candyShop.Sell(expensiveSweet);
            sellerCandyShop.GetBonus(candyShop);
        }
예제 #4
0
        static void Main(string[] args)
        {
            var alcoholShop = new AlcoholShop();

            alcoholShop.Company.Name = "Alcohol Shop OOD";
            alcoholShop.Address      = new Address("Sofia", "Cherni vrah", "20");
            alcoholShop.Name         = "The Awesome Alcohol Shop";
            alcoholShop.Fridge       = new Fridge();
            alcoholShop.Fridge.TurnOn();
            var sellerAlcohol = new Seller("Pesho", "Ivanov", 25);

            alcoholShop.Seller = sellerAlcohol;
            var waitress = new Waitress("Maria", "Marinova", 31);

            alcoholShop.Waitresses.Add(waitress);
            var client = new Client("Ivan", "Ivanov", 28);

            alcoholShop.Clients.Add(client);

            var candyShop = new CandyShop();

            candyShop.Company.Name   = "Candy Shop OOD";
            candyShop.Address        = new Address("Sofia", "Dondukov", "48");
            candyShop.Name           = "The Awesome Candy shop";
            candyShop.AirConditioner = new AirConditioner();
            candyShop.AirConditioner.TurnOn();
            var sellerCandy = new Seller("Grigor", "Iliev", 25);

            candyShop.Seller = sellerCandy;
            var candySpecialist = new CandySpecialist("Gosho", "Dimitrov", 19);

            candyShop.CandySpecialists.Add(candySpecialist);
            var anotherClient = new Client("Vasil", "Vasilev", 35);

            candyShop.Clients.Add(anotherClient);

            var johnnieWalker = new Alcohol("Johnnie Walker", 150);
            var jackDaniels   = new Alcohol("Jack Daniel's", 120);

            alcoholShop.AddGood(johnnieWalker);
            alcoholShop.AddGood(jackDaniels);

            var snickers = new Candy("Snickers", 22);
            var twix     = new Candy("Twix", 48);
            var mars     = new Candy("Mars", 28);

            candyShop.AddGood(snickers);
            candyShop.AddGood(twix);
            candyShop.AddGood(mars);

            Console.WriteLine($"Income AlcoholShop before ---> {alcoholShop.Income} " +
                              $"Item count: {alcoholShop.Goods.Count()}");
            alcoholShop.Sell(jackDaniels);
            Console.WriteLine($"Income Alcoholshop after ---> {alcoholShop.Income} " +
                              $"Item count: {alcoholShop.Goods.Count()}");

            Console.WriteLine();

            Console.WriteLine($"Income CandyShop before ---> {candyShop.Income} " +
                              $"Item count: {candyShop.Goods.Count()}");
            candyShop.Sell(snickers);
            Console.WriteLine($"Income Candyshop after ---> {candyShop.Income} " +
                              $"Item count: {candyShop.Goods.Count()}");

            Console.ReadLine();
        }
예제 #5
0
        static void Main(string[] args)
        {
            var company = new Company();

            company.Name = "Sweet and Drunk";

            var alcoholShop = new AlcoholShop();

            alcoholShop.Name = "Once Upon a Bottle";

            alcoholShop.Address = new Address("Stara Zagora", "Tsar Simeon Veliki", "123");

            alcoholShop.Fridge = new Fridge();

            var candyShop = new CandyShop();

            candyShop.Name = "Candy Heaven";

            candyShop.Address = new Address("Stara Zagora", "Tsar Simeon Veliki", "102");

            candyShop.AirConditioner = new AirConditioner();

            var whiskeyJack = new Alcohol("Jack Daniels", 190);

            var vodkaSmirnoff = new Alcohol("Smirnoff", 70);

            var table1 = new Table("Table 1", "Free");

            var table2 = new Table("Table 2", "Free");

            var skittles = new Candy("Skittles", 2);

            var snickers = new Candy("Snickers", 2.5m);

            var nina = new Waitress("Nina", "Dimova", 24);

            var slaveia = new Waitress("Slaveia", "Todorova", 30);

            var petur = new Client("Petur", "Petrov", 42);

            var neli = new Client("Neli", "Kirilova", 25);

            var todor = new Seller("Todor", "Petrov", 27);

            var dimo = new Seller("Dimitar", "Dimitrov,", 32);

            alcoholShop.AddGood(whiskeyJack);

            alcoholShop.AddGood(vodkaSmirnoff);

            alcoholShop.Tables.Add(table1);

            alcoholShop.Tables.Add(table2);

            candyShop.AddGood(skittles);

            candyShop.AddGood(snickers);

            alcoholShop.Waitress.Add(nina);

            alcoholShop.Waitress.Add(slaveia);

            alcoholShop.Clients.Add(petur);

            candyShop.Clients.Add(neli);

            alcoholShop.Sellers.Add(dimo);

            candyShop.Sellers.Add(todor);

            alcoholShop.Reserve(table1);

            Console.WriteLine($"Income before sell---> {alcoholShop.Income} " +
                              $"Count: {alcoholShop.Goods.Count()}");

            alcoholShop.Sell(whiskeyJack);

            Console.WriteLine($"Display table1---> {table1.TableNumber}");

            Console.WriteLine($"Income after sell---> {alcoholShop.Income} " +
                              $"Count: {alcoholShop.Goods.Count()}");

            Console.Write("List of goods in alcoholShop--->");

            foreach (var good in alcoholShop.Goods)
            {
                Console.WriteLine(good.Name);
            }

            Console.WriteLine($"Count of tables in alcoholShop---> { alcoholShop.Tables.Count}");

            Console.Write("List of tables in alcoholShop--->");

            foreach (var table in alcoholShop.Tables)
            {
                if (table == alcoholShop.Tables[0])
                {
                    Console.Write($"{ table.TableNumber}, ");
                }
                else
                {
                    Console.Write(table.TableNumber);
                }
            }
            Console.WriteLine();
            Console.Write("List of candies in candyShop--->");

            foreach (var candy in candyShop.Goods)
            {
                if (candy == candyShop.Goods[0])
                {
                    Console.Write($"{candy.Name}, ");
                }
                else
                {
                    Console.Write(candy.Name);
                }
            }
            Console.WriteLine();

            Console.WriteLine($"{table1.TableNumber}" + $": {table1.TableStatus}");

            Console.WriteLine($"{table2.TableNumber}" + $": {table2.TableStatus}");

            Console.WriteLine($"candyShop seller---> {candyShop.Sellers[0].FirstName}");

            Console.WriteLine($"alcoholShop seller--->{alcoholShop.Sellers[0].FirstName}");

            Console.ReadLine();
        }