using System; namespace AccountTest { class Account { private decimal _balance = 0; public decimal Balance { get { return _balance; } set { if (value >= 0) _balance = value; } } public Account(decimal initialBalance) { Balance = initialBalance; } public void Deposit(decimal amount) { Balance += amount; } // Method to withdraw given amount of money from // the account's balance if there is enough money. // //public bool Withdraw(decimal amount) public decimal Withdraw(decimal amount) { // if the balance of account has // enough money to be withdrawn if (Balance > amount) { Balance -= amount; return amount; } else { return 0; } } } }