Example #1
0
  public boolean equals(Object object) {
    if (object instanceof Money) {
      Money otherMoney = (Money) object;

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