Exemplo n.º 1
0
 // Subtract given amount of money, returning a new amount of money
 public Money subtract(Money money) {
   //		if (amount.compareTo(money.getAmount()) < 0){
   //			System.out.println("the amount withdraw is greater than the amount in the account!");
   //			return new Money(amount);
   //		}
   return new Money(amount.subtract(money.getAmount()));
 }
Exemplo n.º 2
0
 // Add given amount of money, return a new amount of money
 public Money add(Money money) {
   return new Money(amount.add(money.getAmount()));
 }