X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FWeight.java;fp=src%2FWeight.java;h=3f2a829163130f8bba5c5ed1e22e5fdd0fa916c3;hb=9749119587561f5848349b7a1b9e7d9342944f0d;hp=0000000000000000000000000000000000000000;hpb=dc0e3c9549c9e04431bd008ad44ff4506f9b2fde;p=Persons_Comparator.git diff --git a/src/Weight.java b/src/Weight.java new file mode 100644 index 0000000..3f2a829 --- /dev/null +++ b/src/Weight.java @@ -0,0 +1,21 @@ +public class Weight { + private int weight; + + Weight(int weight) { + setWeight(weight); + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + if (validateWeight(weight)) { + this.weight = weight; + } /* FIXME: raise an error */ + } + + private boolean validateWeight(int weight) { + return (weight > 0); + } +}