~cpp void setValue (String name, int value) { if (name.equals("height")) _height = value; if (name.equals("width")) _width = value; Assert.shouldNeverReachHere(); }
~cpp void setHeight (int arg) { _height = arg; } void setWidth (int arg) { _width = arg; }
~cpp int low = daysTempRange().getLow(); int high = days.TempRange().getHight(); withinPlan = plan.withinRange (low, high);
~cpp withinPlan = plan.withinRange (daysTempRange());
~cpp int basePrice = _quantity * _itemPrice; discountLevel = getDiscountLevel (); double finalPrice = discountedPrice (basePrice, discountLevel);
~cpp int basePrice = _quantity * _itemPrice; double finalPrice = discountedPrice (basePrice);
~cpp Emplyee (int type) { _type = type; }
~cpp static Emplyee create (int type) { return new Emplyee (type); }
~cpp Object lastReading () { return readings.lastElement (); }
~cpp Reading lastReading () { return (Reading) readings.lastElement (); }
~cpp int withdraw(int amount) { if (amount > _balance) return -1; else { _balance -= amount; return 0; } }
~cpp void withdraw(int amount) throws BalanceException { if (amount > _balance) throw new BalanceException (); _balance -= amount; }
~cpp double getValueForPeriod (int periodNumber) { try { return _values[periodNumber]; } catch (ArrayIndexOutOfBoundsException e) { return 0; } }
~cpp double getValueForPeriod (int periodNumber) { if (periodNumber >= _values.length) return 0; return _values[periodNumber]; }