summaryrefslogtreecommitdiff
path: root/src/Q5/README.md
blob: 5769a77dcb623b897b92eaa1846d3a9175b8a0f2 (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
47
48
49
50
51
52
53
Learning Profile for Assignment #2, And Question #5

Name: Mo Khan
Student ID: 3431709

1. Problem Statement:

  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
    1. undergraduate
    1. postgraduate
    1. 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.

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:

  This program does not accept any user input.

1. Sample Input and Output:

  ```bash
  $ mvn package
  $ java -cp target/assignment2*.jar ca.mokhan.comp268.App 5
  Welcome to the village
  The village has 100 citizens
  23 citizens have a doctorate
  25 citizens have a post graduate degree
  33 citizens have a under graduate degree
  19 citizens have a high school diploma
  ```

1. Discussion: