|
@@ -1,72 +1,74 @@
|
1
|
|
-# Ol' McFroilan Had a Farm
|
2
|
|
-* **Objective:** To implement a system indicative of a Farm environment
|
3
|
|
-* **Purpose:** To demonstrate [multi-inheritence design issues](https://www.geeksforgeeks.org/java-and-multiple-inheritance/)
|
4
|
|
-* **Prerequesites:** A `UML` approved by an instructor.
|
5
|
|
-
|
6
|
|
-
|
7
|
|
-# Setting the Plot...
|
8
|
|
-
|
9
|
|
-* Consider a system in which
|
10
|
|
- * `Eater` can `eat` an `Edible `object.
|
11
|
|
- * `NoiseMaker` can `makeNoise`
|
12
|
|
- * `Animal` is a `NoiseMaker` and `Eater`
|
13
|
|
- * `Horse` is an `Animal` and `Rideable`
|
14
|
|
- * `Chicken` is an `Animal` and a `Produce` which `yield` an `EdibleEgg` if `hasBeenFertilized` flag is `false`.
|
15
|
|
-
|
16
|
|
- * `Rider` can `mount` and `dismount` a `Rideable` object.
|
17
|
|
- * `Botanist` can `plant` a `Crop` in a `CropRow`.
|
18
|
|
- * `CropRow` can store a single row of `crop`.
|
19
|
|
- * `Field` can store many `CropRow`
|
20
|
|
- * `Vehicle` are `NoiseMaker` and `Rideable`
|
21
|
|
- * `FarmVehicle` can `operate` on a `Farm`
|
22
|
|
- * `Tractor` is a `FarmVehicle` which can `harvest` a `Crop`.
|
23
|
|
-
|
24
|
|
- * `Aircraft` are `Vehicle` which can `fly`
|
25
|
|
- * `CropDuster` is a `FarmVehicle` and `Aircraft` which can `fertilize` a `CropRow`
|
26
|
|
-
|
27
|
|
-
|
28
|
|
- * `Produce` can `yield` an `Edible` object depending on their `hasBeenFertilized` [flag](https://en.wikipedia.org/wiki/Boolean_flag).
|
29
|
|
- * `Crop` is a `Produce` which can `yield` an `Edible` object depending on its `hasBeenHarvested` and `hasBeenFertilized` flag.
|
30
|
|
- * `CornStalk` is a `Crop` which can `yield` a `EarCorn`
|
31
|
|
- * `TomatoPlant` is a `Crop` which can `yield` a `Tomato`
|
32
|
|
-
|
33
|
|
- * `Person` can `makeNoise` and can `eat` an `Edible` object.
|
34
|
|
- * `Farmer` is an `Eater`, a `Rider`, a `Botanist`, and a `Person`.
|
35
|
|
- * `Stable` stores many `Horse`.
|
36
|
|
- * `FarmHouse` stores many `Person`
|
37
|
|
- * `ChickenCoop` stores many `Chicken`
|
38
|
|
- * `Farm` stores many `Stable`, many `ChickenCoop`, and a single `FarmHouse`
|
39
|
|
-
|
40
|
|
-# Establishing The Plot
|
41
|
|
-
|
42
|
|
-* `Froilan`, a `Farmer` has a `Farm` consisting of
|
43
|
|
- * 1 `Field` of 5 `CropRow`.
|
44
|
|
- * Row 1 has `Corn`
|
45
|
|
- * Row 2 has `Tomato`
|
46
|
|
- * Row 3 and beyond grows arbitrary vegetation.
|
47
|
|
-
|
48
|
|
- * 15 `Chicken` across 4 `ChickenCoop`
|
49
|
|
- * 10 `Horse` across 3 `Stable`.
|
50
|
|
- * 2 `FarmVehicle`
|
51
|
|
- * 1 `Aircraft`
|
52
|
|
- * His sister, `Froilanda`, is a `Pilot` who uses a `CropDuster`.
|
53
|
|
-
|
54
|
|
-
|
55
|
|
-
|
56
|
|
-# The Plot Thickens...
|
57
|
|
-* Create a test cases which simulate a typical work-week for `Froilan` and `Froilanda`.
|
58
|
|
- * The accumulation of your test cases should ensure at least 80% test coverage.
|
59
|
|
-
|
60
|
|
-* The first few weekdays have already been considered for you.
|
61
|
|
-* Create a separate Test class for each day in the following scenario.
|
62
|
|
- * As a farmer, Froilan must stick to a rigorous agricultural routine.
|
63
|
|
- * Every morning, `Froilan` and `Froilanda` begin their morning by
|
64
|
|
- * Riding each `Horse` in each `Stable`.
|
65
|
|
- * Feeding each `Horse` 3 ear of `Corn`.
|
66
|
|
- * For breakfast,
|
67
|
|
- * `Froilan` eats 1 `EarCorn`, 2 `Tomoato`, and 5 `Egg`.
|
68
|
|
- * `Froilanda` eats 2 `EarCorn`, 1 `Tomoato`, and 2 `Egg`.
|
69
|
|
-
|
70
|
|
- * `Sunday`, `Froilan` plants 3 different type of `Crop` in his first, second, and third `CropRow`.
|
71
|
|
- * On `Monday`, his sister, `Froilanda` uses the `CropDuster` to `fly` over the `Field` and `fertilize` each of the `CropRow`
|
72
|
|
- * On `Tuesday`, `Froilan` uses his `Tractor` to `harvest` each `Crop` in each `CropRow`.
|
|
1
|
+# Ol' McFroilan Had a Farm
|
|
2
|
+* **Objective:** To implement a system indicative of a Farm environment
|
|
3
|
+* **Purpose:** To demonstrate [multi-inheritence design issues](https://www.geeksforgeeks.org/java-and-multiple-inheritance/)
|
|
4
|
+* **Prerequesites:** A `UML` approved by an instructor.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+# Setting the Plot...
|
|
8
|
+
|
|
9
|
+* Consider a system in which
|
|
10
|
+ * `Eater` can `eat` an `Edible `object.
|
|
11
|
+ * `NoiseMaker` can `makeNoise`
|
|
12
|
+ * `Animal` is a `NoiseMaker` and `Eater`
|
|
13
|
+ * `Horse` is an `Animal` and `Rideable`
|
|
14
|
+ * `Chicken` is an `Animal` and a `Produce` which `yield` an `EdibleEgg` if `hasBeenFertilized` flag is `false`.
|
|
15
|
+
|
|
16
|
+ * `Rider` can `mount` and `dismount` a `Rideable` object.
|
|
17
|
+ * `Botanist` can `plant` a `Crop` in a `CropRow`.
|
|
18
|
+ * `CropRow` can store a single row of `crop`.
|
|
19
|
+ * `Field` can store many `CropRow`
|
|
20
|
+ * `Vehicle` are `NoiseMaker` and `Rideable`
|
|
21
|
+ * `FarmVehicle` can `operate` on a `Farm`
|
|
22
|
+ * `Tractor` is a `FarmVehicle` which can `harvest` a `Crop`.
|
|
23
|
+
|
|
24
|
+ * `Aircraft` are `Vehicle` which can `fly`
|
|
25
|
+ * `CropDuster` is a `FarmVehicle` and `Aircraft` which can `fertilize` a `CropRow`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+ * `Produce` can `yield` an `Edible` object depending on their `hasBeenFertilized` [flag](https://en.wikipedia.org/wiki/Boolean_flag).
|
|
29
|
+ * `Crop` is a `Produce` which can `yield` an `Edible` object depending on its `hasBeenHarvested` and `hasBeenFertilized` flag.
|
|
30
|
+ * `CornStalk` is a `Crop` which can `yield` a `EarCorn`
|
|
31
|
+ * `TomatoPlant` is a `Crop` which can `yield` a `Tomato`
|
|
32
|
+
|
|
33
|
+ * `Person` can `makeNoise` and can `eat` an `Edible` object.
|
|
34
|
+ * `Farmer` is an `Eater`, a `Rider`, a `Botanist`, and a `Person`.
|
|
35
|
+ * `Stable` stores many `Horse`.
|
|
36
|
+ * `FarmHouse` stores many `Person`
|
|
37
|
+ * `ChickenCoop` stores many `Chicken`
|
|
38
|
+ * `Farm` stores many `Stable`, many `ChickenCoop`, and a single `FarmHouse`
|
|
39
|
+
|
|
40
|
+# Establishing The Plot
|
|
41
|
+
|
|
42
|
+* `Froilan`, a `Farmer` has a `Farm` consisting of
|
|
43
|
+ * 1 `Field` of 5 `CropRow`.
|
|
44
|
+ * Row 1 has `Corn`
|
|
45
|
+ * Row 2 has `Tomato`
|
|
46
|
+ * Row 3 and beyond grows arbitrary vegetation.
|
|
47
|
+
|
|
48
|
+ * 15 `Chicken` across 4 `ChickenCoop`
|
|
49
|
+ * 10 `Horse` across 3 `Stable`.
|
|
50
|
+ * 2 `FarmVehicle`
|
|
51
|
+ * 1 `Aircraft`
|
|
52
|
+ * His sister, `Froilanda`, is a `Pilot`, who uses a `CropDuster`. She is not a `Farmer`.
|
|
53
|
+ * His brother, `Freelan`, is a `Pilot` and a `Farmer`.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+# The Plot Thickens...
|
|
58
|
+* Create a test cases which simulate a typical work-week for `Froilan` and `Froilanda`.
|
|
59
|
+ * The accumulation of your test cases should ensure at least 80% test coverage.
|
|
60
|
+
|
|
61
|
+* The first few weekdays have already been considered for you.
|
|
62
|
+* Create a separate Test class for each day in the following scenario.
|
|
63
|
+ * As a farmer, Froilan must stick to a rigorous agricultural routine.
|
|
64
|
+ * Every morning, `Froilan`, `Froilanda`, and `Freelan` begin their morning by
|
|
65
|
+ * Riding each `Horse` in each `Stable`.
|
|
66
|
+ * Feeding each `Horse` 3 ear of `Corn`.
|
|
67
|
+ * For breakfast,
|
|
68
|
+ * `Froilan` eats 1 `EarCorn`, 2 `Tomoato`, and 5 `Egg`.
|
|
69
|
+ * `Froilanda` eats 2 `EarCorn`, 1 `Tomoato`, and 2 `Egg`.
|
|
70
|
+ * `Freelan` eats 5 `EarCorn`, 3 `Tomoato`, and 2 `Egg`.
|
|
71
|
+
|
|
72
|
+ * `Sunday`, `Froilan` and `Freelan` plant 3 different type of `Crop` in his first, second, and third `CropRow`.
|
|
73
|
+ * On `Monday`, his sister, `Froilanda` uses the `CropDuster` to `fly` over the `Field` and `fertilize` each of the `CropRow`
|
|
74
|
+ * On `Tuesday`, `Froilan` uses his `Tractor` to `harvest` each `Crop` in each `CropRow`.
|