/** * Assignment 2, COMP268 Class: ComputeIntellect.java * * @description A class that can be used to tally the intellect of citizens * @author: mo khan Student ID: 3431709 * @date Jul 13, 2019 * @version 1.0 */ 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; /** * Returns the total # of citizens with a doctorate. * * @return # of citizens with a doctorate */ public int getDoctorate() { return this.doctorate; } /** * Returns the total # of citizens with a high school diploma. * * @return # of citizens with a high school diploma. */ public int getHighschool() { return this.highschool; } /** * Returns the total # of citizens with a post graduate degree. * * @return # of citizens with a post graduate degree. */ public int getPostgraduate() { return this.postgraduate; } /** * Returns the total # of citizens with an under graduate degree. * * @return # of citizens with an under graduate degree. */ public int getUndergraduate() { return this.undergraduate; } /** Tallys the # of citizens with different educational qualifications. */ 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; } } }