summaryrefslogtreecommitdiff
path: root/src/Q5/ComputeIntellect.java
blob: d8a7ee784968ac7ed2c7ecd08ccf3fd728a8e3f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Q5;

import java.io.*;
import java.util.*;

public class ComputeIntellect {
  private int doctorate = 0;
  private int highschool = 0;
  private int postgraduate = 0;
  private int undergraduate = 0;

  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;
      }
    }
  }
}