Skip to content

Instantly share code, notes, and snippets.

@devjaime
Created March 18, 2019 02:00
Show Gist options
  • Select an option

  • Save devjaime/a53601e60987634fa8a92ef92d842a26 to your computer and use it in GitHub Desktop.

Select an option

Save devjaime/a53601e60987634fa8a92ef92d842a26 to your computer and use it in GitHub Desktop.
interfaz para pruebas
public interface IAccount
{
double CurrentBallance { get; }
double Deposit(double amount);
double Withdraw(double amount);
}
public class Account : IAccount
{
double _balance;
public double CurrentBallance { get { return _balance; } }
public double Deposit(double amount)
{
if (amount > 0)
{
_balance += amount;
return _balance;
}
else
{
throw new ArgumentException("Invalid Deposit Amount!");
}
}
public Double Withdraw(double amount)
{
if (amount > 0 && _balance >= amount)
{
_balance -= amount;
}
else
{
throw new ArgumentException("No balance to Withdraw!");
}
return _balance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment