1 public class Weight
implements Comparable
<Weight
> {
11 public int getWeight() {
15 public void setWeight(int weight
) {
16 if (validateWeight(weight
)) {
19 throw new IllegalArgumentException("Weight cannot be negative or zero");
23 private boolean validateWeight(int weight
) {
28 public int compareTo(Weight weight
) {
29 int distance
= weight
.weight
- this.getWeight();