コード例 #1
0
 public bool InsertCoin(ICoin coinType)
 {
     if (IsValid(coinType))
     {
         amount += coinType.Value;
         coinHandler.InsertCoin(coinType.Type(), 1);
         display = "$" + amount.ToString();
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
 public bool IsValid(ICoin usCoin)
 {
     return((usCoin.Type() == CoinTypes.USNickel ||
             usCoin.Type() == CoinTypes.USDime ||
             usCoin.Type() == CoinTypes.USQuarter) ? true : false);
 }