diff --git a/BrokerageLib/Account.cs b/BrokerageLib/Account.cs new file mode 100644 index 0000000..4b19cf3 --- /dev/null +++ b/BrokerageLib/Account.cs @@ -0,0 +1,60 @@ +using System; + +namespace BrokerageLib { + + public class Account { + private string _customerName; + private decimal _balance; + private bool _frozen = false; + + + + public Account(string customerName, decimal balance) { + _customerName = customerName; + _balance = balance; + } + + public string CustomerName { + get { return _customerName; } + } + + public decimal Balance { + get { return _balance; } + } + + public void Debit(decimal amount) { + + + if (amount > _balance) + { + throw new ArgumentOutOfRangeException("amount"); + } + + if (amount < 0) + { + throw new ArgumentOutOfRangeException("amount"); + } + + _balance -= amount; + } + + public void Credit(decimal amount) { + + + if (amount < 0) + { + throw new ArgumentOutOfRangeException("amount"); + } + + _balance += amount; + } + + private void FreezeAccount() { + _frozen = true; + } + + private void UnfreezeAccount() { + _frozen = false; + } + } +} \ No newline at end of file diff --git a/BrokerageLib/BrokerageLib.csproj b/BrokerageLib/BrokerageLib.csproj index 20ff8b6..4d7af3a 100644 --- a/BrokerageLib/BrokerageLib.csproj +++ b/BrokerageLib/BrokerageLib.csproj @@ -40,16 +40,12 @@ + - - - - -