dfea96cdd8226c8dba12b50fa86423ceb2635658
[Persons_Comparator.git] / src / Size.java
1
2 public class Size {
3 private int max = 240;
4 private int min = 20;
5 private int size;
6
7 Size(int size) {
8 setSize(size);
9 }
10
11 public int getSize() {
12 return size;
13 }
14
15 public void setSize(int size) {
16 if (validateSize(size)) {
17 this.size = size;
18 } else {
19 throw new IllegalArgumentException("Size must be between" + this.min + " and " + this.max);
20 }
21 }
22
23 private boolean validateSize(int size) {
24 return (size > max || size < min);
25 }
26 }