예제 #1
0
 public void Sell(Sweet sweet, decimal qty)
 {
     if (sweetInventory[sweet.GetType()] > qty)
     {
         sweetInventory[sweet.GetType()] -= qty;
         moneyInDrawer += pricesOfSweets[sweet.GetType()] * qty;
     }
     ;
 }
예제 #2
0
 public void CreateSweets(Sweet sweet)
 {
     if (sweet.sugarNeeded < sugarInventory)
     {
         sweetInventory[sweet.GetType()] += 1;
         sugarInventory -= sweet.sugarNeeded;
     }
     else
     {
         Console.WriteLine($"Not enough sugar to create the {sweet.GetType().Name}.");
     };
 }