static void Main(string[] args) { Cake cake = new Cake(); Console.WriteLine("Health: " + cake.getHealth() + " Fg: " + cake.GetFoodGroup()); Bread bread = new Bread(); Console.WriteLine("Health: " + bread.getHealth() + " Fg: " + bread.GetFoodGroup()); Console.ReadLine(); }
/// <summary> /// Dummy object creator. for testing. /// </summary> public void DummyDoner() { _breadType = Bread.Durum; _falafels = 0; _feta = true; _majs = false; _meatGrams = 10; _sallad = true; _sauceType = Sauce.RotWeisse; _saurerkraut = false; _tomatoAndCucumber = true; }
public string AddBread(Bread bread) { try { Basket updatedBasket = null; _basketService.Add(bread, CurrentBasket, out updatedBasket); CurrentBasket = updatedBasket; return new JavaScriptSerializer().Serialize(CurrentBasket); } catch (Exception ex) { _logger.Handle(ex); } return "error"; }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; switch (type) { case "Cake": food = new Cake(name, price); break; case "Bread": food = new Bread(name, price); break; default: break; } this.bakedFoods.Add(food); return(string.Format(OutputMessages.FoodAdded, name, type)); }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; if (type == "Bread") { food = new Bread(name, price); } else if (type == "Cake") { food = new Cake(name, price); } this.foods.Add(food); return(string.Format(OutputMessages.FoodAdded, name, type)); }
public void Should_Create_Instance_Of_Bread() { // Arrange const string name = "Double Crust"; //Act var sut = new Bread(name); var serialize = sut.ShouldSerializePrice(); //Assert Assert.IsInstanceOf <Bread>(sut); Assert.IsNotNull(sut.Id); Assert.IsInstanceOf <Guid>(sut.Id); Assert.AreEqual(0, sut.Price); Assert.AreEqual(name, sut.Name); Assert.AreEqual(false, serialize); }
private static IBakedFood CheckIFFoodExistsAndCreateIt(string type, string name, decimal price) { Enum.TryParse(type, out BakedFoodType foodType); IBakedFood currentFood = null; switch (foodType) { case BakedFoodType.Bread: currentFood = new Bread(name, price); break; case BakedFoodType.Cake: currentFood = new Cake(name, price); break; } return(currentFood); }
public string AddFood(string type, string name, decimal price) { BakedFood food = null; if (type == "Bread") { food = new Bread(name, price); } else if (type == "Cake") { food = new Cake(name, price); } this.bakedFoods.Add(food); return($"Added {name} ({type}) to the menu"); }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; if (type == nameof(Bread)) { food = new Bread(name, price); } else if (type == nameof(Cake)) { food = new Cake(name, price); } bakedFoods.Add(food); return($"Added {food.Name} ({food.GetType().Name}) to the menu"); }
public void ReusabletoSimpleList() { ItemContainer container = new ItemContainer(); Bread bread = new Bread { ID = Guid.NewGuid().ToString(), GYearMonthList = new List <GYearMonth>() { new GYearMonth(2017, 7, null), new GYearMonth(1996, 8, "+01:00") } }; container.Items.Add(bread); XmlValidation(container.MakeXml()); }
public void SimpleTypeGYearMonthList() { ItemContainer container = new ItemContainer(); Bread bread = new Bread { ID = Guid.NewGuid().ToString(), GYearMonthList = new List <GYearMonth>() { new GYearMonth(9, 12, null), new GYearMonth(2093, 6, "+09:00") } }; container.Items.Add(bread); XmlValidation(container.MakeXml()); }
public void HoldBread(Bread.Id breadId) { if (holdingBread) { bread.QueueFree(); } else { holdingBread = true; } takeSFX.Play(); bread = Bread.Instance(breadId); GetNode("../../").AddChild(bread); bread.Connect(nameof(Bread.Placed), this, nameof(Placed)); bread.Intangible(); RepositionBread(); }
public static void Main() { Console.WriteLine("Welcome to Pierre's Bakery! Fresh baked hourly, we offer loaves of bread and various pasteries for up to $5.00 USD each plus sales tax."); Console.WriteLine("How many loaves of bread would you like to purchase?"); int itemsBread = int.Parse(Console.ReadLine()); Bread breadOrder = new Bread(itemsBread); int finalBreadCosts = breadOrder.BreadCosts(); Console.WriteLine("How many pasteries woud you like to purchase?"); int itemsPastery = int.Parse(Console.ReadLine()); Pastery pasteryOrder = new Pastery(itemsPastery); int finalPasteryCosts = pasteryOrder.PasteryCosts(); int totalBalance = finalBreadCosts + finalPasteryCosts; Console.WriteLine("The total of your balance due is: $" + totalBalance + " USD. Thank you very much for supporting our business!"); }
public string AddFood (string type, string name, decimal price) { if (type == "Cake") { var food = new Cake(name, 245, price); bakedFoods.Add(food); return ($"Added {name} (Cake) to the menu"); } else { var food = new Bread(name, 200, price); bakedFoods.Add(food); return ($"Added {name} (Bread) to the menu"); } }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; switch (type) { case "Bread": food = new Bread(name, price); break; case "Cake": food = new Cake(name, price); break; } foodList.Add(food); //TODO: idk return($"Added {food.Name} ({food.GetType().Name}) to the menu"); //TODO: if?? }
async private void BreadCompletedHandler2(Oven oven, Bread bread) { Action updateOutputText = () => { OvenClientOutput.Text += "Event Handler 2: Invoked\n"; }; if (OvenClientOutput.Dispatcher.HasThreadAccess) { // If the current thread is the UI thread then execute the lambda. updateOutputText(); } else { // If the current thread is not the UI thread use the dispatcher to execute the lambda on the UI thread. await OvenClientOutput.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(updateOutputText)); } }
public static void Run() { // содаем объект пекаря Baker baker = new Baker(); // создаем билдер для ржаного хлеба BreadBuilder builder = new RyeBreadBuilder(); // выпекаем Bread ryeBread = baker.Bake(builder); Console.WriteLine(ryeBread.ToString()); // оздаем билдер для пшеничного хлеба builder = new WheatBreadBuilder(); Bread wheatBread = baker.Bake(builder); Console.WriteLine(wheatBread.ToString()); Console.Read(); }
public void CalcOrderTotalCost_CalculateCostOfBreadAndPastryOrdersWithZeroPastryCount_Int() { int loaves = 6; int pastries = 0; int expectedOrderTotalCost = 20; Order newOrder = new Order(); Bread bread = new Bread(); Pastry pastry = new Pastry(); bread.AdjustBreadCost(loaves); pastry.AdjustPastryCost(pastries); bread.CalcBreadTotalCost(loaves); pastry.CalcPastryTotalCost(pastries); newOrder.CalcOrderTotalCost(bread.BreadOrderTotalCost, pastry.PastryOrderTotalCost); Assert.AreEqual(expectedOrderTotalCost, newOrder.OrderTotalCost); }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; if (type == "Bread") { food = new Bread(name, price); } else if (type == "Cake") { food = new Cake(name, price); } bakedFoods.Add(food); var message = string.Format(OutputMessages.FoodAdded, food.Name, food.GetType().Name); return(message); }
public void SetObject_SetObject_Bread() { int quant = 0; int price = 0; Bread newBread = new Bread(quant, price); int updatedQuant = 2; newBread.Quant = updatedQuant; int finalQu = newBread.Quant; int updatedPrice = 2; newBread.Price = updatedPrice; int finalPr = newBread.Price; Assert.AreEqual(updatedQuant, finalQu); Assert.AreEqual(updatedPrice, finalPr); }
public void MakeBreakfast() { // делаем кофе BoiledWater boiledWater = new BoiledWater(); // набираем воду CoffeeBeans coffeeBeans = new CoffeeBeans(); // берем зерна coffee = new Coffee(coffeeBeans, boiledWater); // варим кофе // делаем бутерброд Bread bread = new Bread(); // покупаем хлеб Sausage sausage = new Sausage(); // покупаем колбасу PieceBread pieceBread = Knife.Cut(bread); // режем хлеб SausageField sausageField = Knife.Cut(sausage); // режем колбасу sandwich = new Sandwich(pieceBread, sausageField); // складываем все вместе Console.WriteLine("Завтрак готов"); }
public static void Main() { Console.WriteLine("Would you like to order some of our fine Breads? ['Y' for yes, 'Enter' for no]"); string breadYesOrNo = Console.ReadLine().ToLower(); if (breadYesOrNo == "y") { Console.WriteLine("What type of bread do you want?['french' or 'pita']"); string breadSelection = Console.ReadLine(); Console.WriteLine("How many?"); int breadQuant = int.Parse(Console.ReadLine()); Bread breadOrder = new Bread(breadSelection, breadQuant); int breadGt = breadOrder.GetSaleCost(); Main(); } Console.WriteLine("Would you like to order some of our fine Pastries? ['Y' for yes, 'Enter' for no]"); string pastryYesOrNo = Console.ReadLine().ToLower(); if (pastryYesOrNo == "y") { Console.WriteLine("What type of pastry do you want?"); string pastrySelection = Console.ReadLine(); Console.WriteLine("How many?"); int pastryQuant = int.Parse(Console.ReadLine()); Pastry newPastryOrder = new Pastry(pastrySelection, pastryQuant); int pastryGt = newPastryOrder.GetSaleCost(); } List <Bread> breadBasket = Bread.GetAll(); List <Pastry> pastryBasket = Pastry.GetAll(); foreach (Bread bread in breadBasket) { int breadGt = bread.GetSaleCost(); Console.WriteLine("Total Bread: " + breadGt); } foreach (Pastry pastry in pastryBasket) { int pastryGt = pastry.GetSaleCost(); Console.WriteLine("Total Pastry: " + pastryGt); } }
public void EditOrder() { PrintOrder(); Console.WriteLine("Which item would you like to edit?"); string choice = Console.ReadLine().ToLower(); if ((choice == "bread" || choice == "b") && UserBreads > 0) { Console.WriteLine("You are editing your bread order. How many loaves would you like to remove? [Enter a number]"); int amount = int.Parse(Console.ReadLine()); if (UserBreads >= amount) { UserBreads -= Breads.RemoveBread(amount); Console.WriteLine($"Current Bread: ({UserBreads}) loaves for ${Bread.GetCost(UserBreads)}"); } else { Console.Write("You cannot remove more bread than you have already ordered."); } } else if (choice == "pastry" || choice == "pastries" || choice == "p") { Console.WriteLine("You are editing your pastry order. How many pastries would you like to remove? [Enter a number]"); int amount = int.Parse(Console.ReadLine()); if (UserPastries >= amount) { UserPastries -= Pastries.RemovePastry(amount); Console.WriteLine($"Current Pastries: ({UserPastries}) pastries for ${Pastry.GetCost(UserPastries)}"); } else { Console.Write("You cannot remove more pastries than you have already ordered."); } } else if (choice == "nothing" || choice == "x" || choice == "n" || choice == "none") { Console.Write("Okay. "); } else { Console.Write("Please enter a valid input. "); EditOrder(); } }
static void Main(string[] args) { var shoppingBasket = new ShoppingBasket.ShoppingBasket(); var bread = new Bread { Price = 1, Amount = 6 }; var eggs = new Egg { Price = 0.8, Amount = 2 }; //Every third bread is 50 % off Discount <Bread> breadDiscount = new Discount <Bread> { Amount = 2, DiscountPercentage = 50, Offset = 1 }; //Every bread is 50 % off Discount <Bread> breadDiscount2 = new Discount <Bread> { Amount = 1, DiscountPercentage = 50, Offset = 0 }; //Discount<Bread> breadDiscount = new Discount<Bread> //{ // Amount = 2, // DiscountPercentage = 100, //}; shoppingBasket.Add(bread); shoppingBasket.Add(breadDiscount2); Console.WriteLine("Test"); Console.WriteLine($"Total price: {shoppingBasket.GetPrice().ToString()}"); Console.ReadKey(); }
public IBakedFood CreateFood(string type, string name, decimal price) { IBakedFood food = null; if (type == "Bread") { food = new Bread(name, price); } else if (type == "Cake") { food = new Cake(name, price); } else { throw new ArgumentException("InvalidType"); } return(food); }
public string AddFood(string type, string name, decimal price) { IBakedFood food = null; if (type == "Bread") { food = new Bread(name, price); } else if (type == "Cake") { food = new Cake(name, price); } else { } resturantObjects["food"].Add(food); return($"Added {food.Name} ({food.GetType().Name}) to the menu"); }
public static void StartMenu() { Console.WriteLine(" Menu Options:"); Console.WriteLine(" 'B' for Bread | 'P' for Pastries"); string menuType = (Console.ReadLine().ToUpper()); if (menuType == "B") { Bread.BMenu(); } else if (menuType == "P") { Pastry.PMenu(); } else { Main(); } }
public void ListOfSimpleTypeGDay() { ItemContainer container = new ItemContainer(); GDay day1 = new GDay(1, "Z"); GDay day2 = new GDay(9, "+09:00"); GDay day3 = new GDay(12, "-01:00"); Bread bread = new Bread { ID = Guid.NewGuid().ToString(), Gday = new List <GDay>() { day1, day2, day3 } }; container.Items.Add(bread); XmlValidation(container.MakeXml()); }
public void ListOfSimpleTypeGMonth() { ItemContainer container = new ItemContainer(); GMonth month1 = new GMonth(1, "Z"); GMonth month2 = new GMonth(9, "+09:00"); GMonth month3 = new GMonth(12, "+01:00"); Bread bread = new Bread { ID = Guid.NewGuid().ToString(), Gmonth = new List <GMonth>() { month1, month2, month3 } }; container.Items.Add(bread); XmlValidation(container.MakeXml()); }
public void ListOfSimpleTypeGyear() { ItemContainer container = new ItemContainer(); GYear year1 = new GYear(1997, "+09:00"); GYear year2 = new GYear(2002, "+09:00"); GYear year3 = new GYear(2017, "Z"); Bread bread = new Bread { ID = Guid.NewGuid().ToString(), Gyear = new List <GYear>() { year1, year2, year3 } }; container.Items.Add(bread); XmlValidation(container.MakeXml()); }
public void TestingCompareNumerousIngreidient() { string[] line = { "Вода", "1кг", "2р", "0Дж", "Мука", "0,2кг", "1р", "200Дж" }; double volume, price, calorie; int numerous = 10; volume = 1.2; price = 3; calorie = 200; Bakery product = new Bread(line, volume, price, calorie, numerous); int numerous_user = 1; bool expected = true; bool actual = product.NumerousIngridients(numerous_user); Assert.AreEqual(expected, actual); }
public static void Main() { Bread biscuit = new Bread("Tender Paw Biscuits", 5, 0); Pastry sweetroll = new Pastry("Catnip Sweet Roll", 2, 0); List <Bread> Breads = new List <Bread>() { biscuit }; List <Pastry> Pastrys = new List <Pastry>() { sweetroll }; Console.WriteLine("Welcome to Haru's Bakery"); Console.WriteLine("We have a couple of specials today:"); Console.WriteLine("Buy two Breads get one free!"); Console.WriteLine("Buy one Pastry for $2, or you can get three for $5!"); Console.WriteLine("Take a look at our menu"); foreach (Bread selection in Breads) { Console.WriteLine(selection.BreadName); } foreach (Pastry selection in Pastrys) { Console.WriteLine(selection.PastryName); } Console.WriteLine("Would you like the biscuit or the sweetroll?"); string start = Console.ReadLine(); if (start == "biscuit") { Console.WriteLine("Thats great! How many would you like to order?"); biscuit.BreadQuantity = int.Parse(Console.ReadLine()); biscuit.OrderBread(); } else if (start == "sweetroll") { Console.WriteLine("Alright! How many would you like to order?"); sweetroll.PastryQuantity = int.Parse(Console.ReadLine()); sweetroll.OrderPastry(); } }
/// <summary> /// BREAD UPGRADE /// </summary> public void upgradeBread() { if (em.money >= breadCost()) { em.spend(breadCost()); em.breadID++; Bread.updateButton(); wm.em.recalculate(); playKaching(); em.list.transform.FindChild("Value").transform.FindChild("SandwichValueText").GetComponent <Text>().text = "$" + Util.encodeNumber(em.getSandwichValue()) + " each &"; if (BuyBread != null) { BuyBread(); } } else { notEnough(); } }
/// <summary> /// Creates the Döner by querying the hungry customer for content. /// </summary> /// <returns></returns> public Doner OrderDoner() { Console.WriteLine("What do you want with your Döner?"); _meatGrams = int.Parse(Ask("How much meat (grams): ")); if (_meatGrams == 0) { _falafels = int.Parse(Ask("So no meat..\n How about falafels (amount): ")); } switch (Ask("Sallad (y/n): ")) { case "y": _sallad = true; break; case "n": _sallad = false; break; default: _sallad = false; break; } _tomatoAndCucumber = (bool) Ask("Tomato and Cucumbers (y/n): ", AskType.YesNo); _majs = (bool) Ask("Majs (y/n): ", AskType.YesNo); _saurerkraut = (bool) Ask("Sauerkraut (y/n): ", AskType.YesNo); _feta = (bool) Ask("feta (y/n): ", AskType.YesNo); _sauceType = (Sauce) Ask("what type of sauce (CHILI,GARLIC,TZASIKI,ROTWEISSE): ", AskType.Sauce); _breadType = (Bread) Ask("what type of bread(durum/pita): ", AskType.Bread); return this; }