Commit a76b31a

mo <mo.khan@gmail.com>
2019-07-13 19:55:21
add description of the code
1 parent e5aefc5
src/Q5/Citizen.java
@@ -76,9 +76,7 @@ public class Citizen {
     return String.valueOf(i);
   }
 
-  /**
-   * Resets the internal id counter to zero.
-   */
+  /** Resets the internal id counter to zero. */
   public static void resetId() {
     id = 0;
   }
src/Q5/ComputeIntellect.java
@@ -53,11 +53,9 @@ public class ComputeIntellect {
     return this.undergraduate;
   }
 
-  /**
-   * Tallys the # of citizens with different educational qualifications.
-   */
+  /** Tallys the # of citizens with different educational qualifications. */
   public void distributionOfQualification(Citizen[] citizens) {
-    for (Citizen citizen : citizens) {
+    for (Citizen citizen : citizens)
       switch (citizen.getEducationalQualification()) {
         case Citizen.DOCTORATE:
           this.doctorate++;
@@ -72,6 +70,5 @@ public class ComputeIntellect {
           this.highschool++;
           break;
       }
-    }
   }
 }
src/Q5/README.md
@@ -29,6 +29,11 @@ the number of citizens corresponding to each of the four educational qualificati
 ```
 
 1. Description of the Code:
+
+The code has 3 classes. The entry point into the console application is
+in the `Village` class. I chose to store the citizens of the village in
+a generic `ArrayList<T>`.
+
 1. Errors and Warnings:
 1. Sample Input and Output:
 
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();