Пример #1
0
  public boolean equals(Object object) {
    if (object instanceof Money) {
      Money otherMoney = (Money) object;

      return (cents == otherMoney.getCents());
    }
    return false;
  }
Пример #2
0
 public void subtract(Money otherMoney) {
   cents -= otherMoney.getCents();
 }
Пример #3
0
 public boolean greaterThan(Money otherMoney) {
   if (cents > otherMoney.getCents()) {
     return true;
   }
   return false;
 }
Пример #4
0
 public void add(Money otherMoney) {
   cents += otherMoney.getCents();
 }