Example Problem: Representing a currency

class Money {
    private int fAmount;
    private String fCurrency;

    public Money(int amount, String currency) {
        fAmount= amount;
        fCurrency= currency;
    }

    public int amount() {
        return fAmount;
    }

    public String currency() {
        return fCurrency;
    }

    public Money add(Money m) {
      return new Money(amount()+m.amount(), currency());
    }
}


previous | start | next .... [Slide 3] ....