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

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