public StoreItem(string t_itemID, string t_itemName, float t_price, TypeCoins t_type) { itemID = t_itemID; itemName = t_itemName; if (t_type == TypeCoins.A) { priceCoinsA = t_price; } else { priceCoinsB = t_price; } }
//recibe creditos public string ReceiveTransfer(float t_credits, TypeCoins type) { string result = ""; if (type == TypeCoins.A) { creditsA += t_credits; } else { creditsB += t_credits; } result = "Transferencia con exito, nuevo saldo = " + creditsA + "A | B" + creditsB; return(result); }
//envia creditos public bool SendTransfer(float t_credits, TypeCoins type) { bool result = false; if (CanSendTransfer(t_credits, type)) { if (type == TypeCoins.A) { creditsA -= t_credits; result = true; } else { creditsB -= t_credits; result = true; } } return(result); }
public bool CanSendTransfer(float t_credits, TypeCoins type) { bool result = false; if (type == TypeCoins.A) { if (creditsA >= t_credits) { result = true; } } else { if (creditsB >= t_credits) { result = true; } } return(result); }
public Coin(TypeCoins coin) { switch (coin) { case TypeCoins.Dolar: nome = "USD"; break; case TypeCoins.EUR: nome = "EUR"; break; case TypeCoins.Bitcoin: nome = "BTC"; break; default: nome = "OTHER"; break; } }