summaryrefslogtreecommitdiff
path: root/src/Q5/Village.java
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2019-07-13 13:55:21 -0600
committermo <mo.khan@gmail.com>2019-07-13 13:55:21 -0600
commita76b31a8639190c6e98fefc0e62e42b937501f94 (patch)
tree12bd163a8f80cc0cdaa472430a9fb902c08fe411 /src/Q5/Village.java
parente5aefc5e25159ad6f8ce2a08e754b8ed2f5c546f (diff)
add description of the code
Diffstat (limited to 'src/Q5/Village.java')
-rw-r--r--src/Q5/Village.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/Q5/Village.java b/src/Q5/Village.java
index 09fc9a9..47c6891 100644
--- a/src/Q5/Village.java
+++ b/src/Q5/Village.java
@@ -15,52 +15,37 @@ public class Village {
private List<Citizen> citizens;
private int numberOfCitizens;
- /**
- * Creates an instance of a village.
- * There is no cap to the # of villagers.
- */
+ /** Creates an instance of a village. There is no cap to the # of villagers. */
public Village() {
this(new ArrayList<Citizen>());
}
- /**
- * Creates an instance of a village with specific villagers.
- */
+ /** Creates an instance of a village with specific villagers. */
public Village(List<Citizen> citizens) {
this.citizens = citizens;
}
- /**
- * @return the number of citizens in the village.
- */
+ /** @return the number of citizens in the village. */
public int getNumberOfCitizens() {
return this.citizens.size();
}
- /**
- * Adds a citizen to the village with a specific qualification.
- */
+ /** Adds a citizen to the village with a specific qualification. */
public void addCitizen(int qualification) {
this.citizens.add(new Citizen(Citizen.generateId(), qualification));
}
- /**
- * Adds a citizen to the village with a random qualification.
- */
+ /** Adds a citizen to the village with a random qualification. */
public void addCitizen() {
this.addCitizen(Citizen.generateEducationalQualification());
}
- /**
- * @return the array of citizens in the village.
- */
+ /** @return the array of citizens in the village. */
public Citizen[] getCitizens() {
return this.citizens.toArray(new Citizen[this.citizens.size()]);
}
- /**
- * The entry point to the console application.
- */
+ /** The entry point to the console application. */
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Village village = new Village();