1 public class Weight
implements Comparable
<Weight
> {
8 public int getWeight() {
12 public void setWeight(int weight
) {
13 if (validateWeight(weight
)) {
16 throw new IllegalArgumentException("Weight cannot be negative or zero");
20 private boolean validateWeight(int weight
) {
25 public int compareTo(Weight weight
) {
26 int distance
= weight
.weight
- this.getWeight();