public void TakeMoney(Coins coin) { if (CheckCoins(coin)) { if (coinDesk.ContainsKey(coin.CoinAmmount)) { coinDesk[coin.CoinAmmount] += 1; } else { coinDesk.Add(coin.CoinAmmount, 1); } } }
private bool CheckCoins(Coins coins) { if (coins.CoinAmmount == 1 || coins.CoinAmmount == 2 || coins.CoinAmmount == 5 || coins.CoinAmmount == 10 || coins.CoinAmmount == 20 || coins.CoinAmmount == 50 || coins.CoinAmmount == 100) { return true; } return false; }