private Currency currency; private int amount; Money(final Currency currency, final int amount) { this.currency = currency; this.amount = amount; } Currency getCurrency() { return this.currency; } int getAmount() { return this.amount; } Money add(Money another) { if (this.currency != another.getCurrency()) { throw new IllegalArgumentException("通貨が異なります"); } return new Money(this.currency, this.amount + another.getAmount()); } }