diff options
| author | mo khan <mo@mokhan.ca> | 2019-08-11 16:37:54 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2019-08-11 16:37:54 -0600 |
| commit | 30c5d770feaf5a5c83d131b3af0db4d02e103578 (patch) | |
| tree | c1997d3ef97dd87f8eebfe1fc7858bb1112f1030 /src/Q5 | |
| parent | 39ae7885659d6d1c6397a900eb46898e9443b459 (diff) | |
update program profile for Q5
Diffstat (limited to 'src/Q5')
| -rw-r--r-- | src/Q5/README.md | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/src/Q5/README.md b/src/Q5/README.md index 4d4fac9..5769a77 100644 --- a/src/Q5/README.md +++ b/src/Q5/README.md @@ -5,47 +5,49 @@ Student ID: 3431709 1. Problem Statement: -```text -Create three classes: `Village`, `Citizen`, and `ComputeIntellect`. + 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 `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 Citizen class has `citizenId` and `educationalQualification` as instance variables. -The `ComputeIntellect` class has a `distributionOfQualification()` method. + The `ComputeIntellect` class has a `distributionOfQualification()` method. -Create 100 Citizen objects using citizenId for the range [1 to 100]. + 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, -* 4 = doctorate. + Randomly generate the educational qualification in the range 1 to 4, where -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. 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>`. + 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 -Choose exercise: (1-10) -5 -Welcome to the village -The village has 100 citizens -29 citizens have a doctorate -24 citizens have a post graduate degree -21 citizens have a under graduate degree -26 citizens have a high school diploma -``` + ```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: |
