public boolean addThing(Thing thing) { if ((thing.getVolume() + this.getVolume()) <= this.maximumCapacity) { this.things.add(thing); return true; } return false; }
@Override public int getVolume() { int volume = 0; for (Thing t : this.things) { volume = volume + t.getVolume(); } return volume; }