public List <Chocolate> CreateOrder(int dark, int white, int milk, int peanut, int almond) { List <Chocolate> newOrder = new List <Chocolate>(); for (int i = 0; i < dark; i++) { Chocolate newDarkChoco = new Chocolate(Kind.Dark); newOrder.Add(newDarkChoco); } for (int i = 0; i < white; i++) { Chocolate newWhiteChoco = new Chocolate(Kind.White); newOrder.Add(newWhiteChoco); } for (int i = 0; i < milk; i++) { Chocolate newMilkChoco = new Chocolate(Kind.Milk); newOrder.Add(newMilkChoco); } for (int i = 0; i < peanut; i++) { Chocolate newPeanutChoco = new Chocolate(Kind.Peanut); newOrder.Add(newPeanutChoco); } for (int i = 0; i < almond; i++) { Chocolate newAlmondChoco = new Chocolate(Kind.Almond); newOrder.Add(newAlmondChoco); } return(newOrder); }
private static void AddChoco(int kind, List <Chocolate> newOrder) { for (int i = 0; i < kind; i++) { Chocolate choco = new Chocolate((Kind)Enum.Parse(typeof(Kind), nameof(kind), true)); newOrder.Add(choco); } }
private void ProduceChocoByKind(int kind) { for (int i = 0; i < kind; i++) { Chocolate chocolate = new Chocolate((Kind)Enum.Parse(typeof(Kind), nameof(kind), true), DateTime.Now); RawMaterial -= 0.15; ChocolateWarehouse.Add(chocolate); } }
public static List <Chocolate> CreateChocolatesRequest() { List <Chocolate> chocolates = new List <Chocolate>(); Console.WriteLine("How many dark chocolates do you want to order?"); int dark = int.Parse(Console.ReadLine()); Console.WriteLine("How many white chocolates do you want to order?"); int white = int.Parse(Console.ReadLine()); Console.WriteLine("How many milk chocolates do you want to order?"); int milk = int.Parse(Console.ReadLine()); Console.WriteLine("How many almond chocolates do you want to order?"); int almond = int.Parse(Console.ReadLine()); Console.WriteLine("How many peanut chocolates do you want to order?"); int peanut = int.Parse(Console.ReadLine()); for (int i = 0; i < dark; i++) { Chocolate newDarkChoco = new Chocolate(Kind.Dark); chocolates.Add(newDarkChoco); } for (int i = 0; i < white; i++) { Chocolate newWhiteChoco = new Chocolate(Kind.White); chocolates.Add(newWhiteChoco); } for (int i = 0; i < milk; i++) { Chocolate newMilkChoco = new Chocolate(Kind.Milk); chocolates.Add(newMilkChoco); } for (int i = 0; i < almond; i++) { Chocolate newAlmondChoco = new Chocolate(Kind.Almond); chocolates.Add(newAlmondChoco); } for (int i = 0; i < peanut; i++) { Chocolate newPeanutChoco = new Chocolate(Kind.Peanut); chocolates.Add(newPeanutChoco); } return(chocolates); }
public void ResupplyChocolate(Factory factoryRelated) { List <Chocolate> chocolatesListRequest = Chocolate.CreateChocolatesRequest(); ChocolateOrder newChocolatesRequest = new ChocolateOrder(chocolatesListRequest, factoryRelated, this); //Chocolates list is used to produce an order tracking the relation between store and customer and assigning price data ChocolateOrder chocolatesDelivery = factoryRelated.ShipChocolateOrder(this, newChocolatesRequest); //Invoking factory method passing the current store to return a valid representation of chocolate data, extracted from the factory's chocolate stock foreach (var item in chocolatesDelivery.Chocolates) //Populating store chocolate stock catalog { Chocolates.Add(item); } Console.WriteLine("Resupply was successful"); }
public void ProduceChocolate(int dark, int white, int milk, int almond, int peanut) { for (int i = 0; i < dark; i++) { Chocolate darkCholate = new Chocolate(Kind.Dark, DateTime.Now); RawMaterial -= 0.15; ChocolatesStock.Add(darkCholate); } for (int i = 0; i < white; i++) { Chocolate whiteChocolate = new Chocolate(Kind.White, DateTime.Now); RawMaterial -= 0.2; ChocolatesStock.Add(whiteChocolate); } for (int i = 0; i < milk; i++) { Chocolate milkChocolate = new Chocolate(Kind.Milk, DateTime.Now); RawMaterial -= 0.25; ChocolatesStock.Add(milkChocolate); } for (int i = 0; i < almond; i++) { Chocolate almondChocolate = new Chocolate(Kind.Almond, DateTime.Now); RawMaterial -= 0.22; ChocolatesStock.Add(almondChocolate); } for (int i = 0; i < peanut; i++) { Chocolate peanutChocolate = new Chocolate(Kind.Peanut, DateTime.Now); RawMaterial -= 0.26; ChocolatesStock.Add(peanutChocolate); } }