Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Programming 5. [20 marks] Create three classes: Village, citizen, and ComputeIntellect. The Village class has an instance variable called numberOfCitizens and an array that
Java Programming
5. [20 marks] Create three classes: Village, citizen, and ComputeIntellect. The Village class has an instance variable called numberOfCitizens and an array that holds a maximum of 100 Citizen objects. The Citizen class has citizenId and educationalQualification as instance variables. The ComputeIntellect class has a distributionofQualification() method. Create 100 Citizen objects using citizenId for the range [1 to 100]. Randomly generate the educational qualification in the range [1 to 4], where 1-high school, 2-undergraduate, 3 postgraduate, and 4 doctorate. Store these 100 objects in a Village object using an array- any array of your choice. The distributionofQualification) method loops through the 100 objects and counts the number of citizens corresponding to each of the four educational qualifications. ComputeIntellect Village Attributes +int doctorate + int highschool + int postgraduate + int undergraduate + static final int DOCTORATE +static final int HIGH SCHOOL + static final int POSTGRADUATE + static final int UNDERGRADUATE Operations + public void distributionOfQualification(Citizen[] citizens) Attributes + Citizen[] citizens + int pointer + private int numberOfCitizens Operations + public int getNumberOfCitizensO) + public Village() + public void addCitizen (int qual) + public void addCitizen) Citizen Attributes + int citizenId + int educationalQualification + static final int DOCTORATE + static final int HIGH SCHOOL + static final int POSTGRADUATE + static final int UNDERGRADUATE + static int id Operations + public Citizen(int id, int qualif) + public static int generateEducationalQualification) + public static int generateId() + public static String convert(int i) + public static void resetId)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started