Marvin: Account.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Marvin.Examples
{
    public class Account{
      public Account(ICollection<LedgerEntry> ledgers){
          Ledgers = ledgers;
      }

      role Ledgers{
          void AddEntry(string message,decimal amount){
              Ledgers.Add(new LedgerEntry(message, amount));
          }
          decimal GetBalance(){
              return ((ICollection<LedgerEntry>)Ledgers).Sum(e => e.Amount);
          }
      }

      public decimal Balance{
        get  {
              return Ledgers.GetBalance();
          }
      }

      public void IncreaseBalance(decimal amount)
      {
          Ledgers.AddEntry("depositing",amount);
      }

      public void DecreaseBalance(decimal amount)
      {
          Ledgers.AddEntry("withdrawing",0-amount);
      }
    }
}