Basic classes structure that deal with Person attributes.
[Persons_Comparator.git] / src / Weight.java
diff --git a/src/Weight.java b/src/Weight.java
new file mode 100644 (file)
index 0000000..3f2a829
--- /dev/null
@@ -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);
+    }
+}