コード例 #1
0
 public void Sell(Ore o, int price)
 {
     if (Inventory.Contains(o))
     {
         Inventory.Remove(o);
         Balance += price;
     }
 }
コード例 #2
0
 public Trend(Ore o, string minPrice, string maxPrice, string[] ts, string[] tb)
 {
     this.ore        = o;
     this.minPrice   = minPrice;
     this.maxPrice   = maxPrice;
     this.topSellers = ts;
     this.topBuyers  = tb;
 }
コード例 #3
0
 public void Buy(Ore o, int price)
 {
     if (Inventory?.Count >= (int)MaxCapacity)
     {
         throw new MaxCapacityReachedException();
     }
     else if (Balance - price < 0)
     {
         throw new InsuficientFundsException();
     }
     else
     {
         Inventory.Add(o);
         Balance -= price;
     }
 }