summaryrefslogtreecommitdiff
path: root/src/Q5/ComputeIntellect.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Q5/ComputeIntellect.java')
-rw-r--r--src/Q5/ComputeIntellect.java43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/Q5/ComputeIntellect.java b/src/Q5/ComputeIntellect.java
index f195783..d8a7ee7 100644
--- a/src/Q5/ComputeIntellect.java
+++ b/src/Q5/ComputeIntellect.java
@@ -4,10 +4,43 @@ import java.io.*;
import java.util.*;
public class ComputeIntellect {
- private int doctorate;
- private int highschool;
- private int postgraduate;
- private int undergraduate;
+ private int doctorate = 0;
+ private int highschool = 0;
+ private int postgraduate = 0;
+ private int undergraduate = 0;
- public void distributionOfQualification(Citizen[] citizens) {}
+ public int getDoctorate() {
+ return this.doctorate;
+ }
+
+ public int getHighschool() {
+ return this.highschool;
+ }
+
+ public int getPostgraduate() {
+ return this.postgraduate;
+ }
+
+ public int getUndergraduate() {
+ return this.undergraduate;
+ }
+
+ public void distributionOfQualification(Citizen[] citizens) {
+ for (Citizen citizen : citizens) {
+ switch (citizen.getEducationalQualification()) {
+ case Citizen.DOCTORATE:
+ this.doctorate++;
+ break;
+ case Citizen.POSTGRADUATE:
+ this.postgraduate++;
+ break;
+ case Citizen.UNDERGRADUATE:
+ this.undergraduate++;
+ break;
+ case Citizen.HIGH_SCHOOL:
+ this.highschool++;
+ break;
+ }
+ }
+ }
}