public void PayTShirt(TShirt tshirt) { foreach (var variation in _variations) { Console.WriteLine($"Applying {variation.GetType().Name}"); variation.Cost(tshirt); Console.WriteLine($"TShirt cost after applying {variation.GetType().Name} is: {tshirt.Price}"); Console.WriteLine(); } _paymentMethod.Pay(tshirt.Price); }
public static void EshopChoose() { int choice; Console.WriteLine("Welcome to my T-Shirt e-shop."); Console.WriteLine(); Console.WriteLine("Please choose your T-shirt color. \n1) Red, 2) Orange, 3) Yellow, 4) Green, 5) Blue, 6) Indigo, 7) Violet"); while (!int.TryParse(Console.ReadLine().Trim(), out choice)) { Console.WriteLine("Wrong input try again"); } Console.WriteLine(); var color = ChooseColor(choice); Console.WriteLine("Please choose your T-shirt size. \n1) XS, 2) S, 3) M, 4) L, 5) XL, 6) XXL, 7) XXXL"); while (!int.TryParse(Console.ReadLine().Trim(), out choice)) { Console.WriteLine("Wrong input try again"); } Console.WriteLine(); var size = ChooseSize(choice); Console.WriteLine("Please choose your T-shirt fabric. \n1) Wool, 2) Cotton, 3) Polyester, 4) Rayon, 5) Linen, 6) Cashmere, 7) Silk"); while (!int.TryParse(Console.ReadLine().Trim(), out choice)) { Console.WriteLine("Wrong input try again"); } Console.WriteLine(); var fabric = ChooseFabric(choice); Console.Write("How would you like to pay? 1) Credit Card, 2) Bank Transfer, 3) Cash : "); while (!int.TryParse(Console.ReadLine().Trim(), out choice)) { Console.WriteLine("Wrong input try again"); } Console.WriteLine(); var paymentMethod = ChoosePaymentMethod(choice); var eshop = new Eshop(); var variations = new List <Variation>() { new ColorVariation(), new FabricVariation(), new SizeVariation() }; TShirt shirt = new TShirt(color, size, fabric); eshop.Variation(variations); eshop.SelectPaymentMethod(paymentMethod); eshop.PayTShirt(shirt); }
public override decimal Cost(TShirt tshirt) { tshirt.Price += _fabricVariations[tshirt.Fabric]; return(tshirt.Price); }
public override decimal Cost(TShirt tshirt) { tshirt.Price += _sizeCosts[tshirt.Size]; return(tshirt.Price); }
public override decimal Cost(TShirt tshirt) { tshirt.Price += _colorCosts[tshirt.Color]; return(tshirt.Price); }
public abstract decimal Cost(TShirt tshirt);