diff --git a/part_3/exercise_3/src/readme.md b/part_3/exercise_3/src/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..a5b2ab1e889e3f3363370e2368f396ccfee71cbd --- /dev/null +++ b/part_3/exercise_3/src/readme.md @@ -0,0 +1,23 @@ +## Answer: +For the requirement: +> - The program could potentially support more shapes in the future than the three currently listed (triangle, quadrilateral, circle). +> - More calculable operations should be supported than currently (area and boundaries). +> - One generally desired feature is that the program can better utilize the support offered by the compiler and the language types for describing the operational logic, given that a compiled language is being used (Java, but also applicable to other languages). + +- Currently, we have `area` and `boundaries` operations in all shapes (triangle, quadrilateral, circle) and the formulas of the operations are based on the shape type (e.g: the area of the circle is different from the area of the triangle). + + -> + - We have these classes: `Triangle`, `Quadrilateral` and `Circle`. All of them implement an interface: `ShapeInterface` with 2 methods for now: `boundaries()` and `area()`. + - Later, if we have another shape, we can create a new class that implements the `ShapeInterface`. If we have more operations, we should add the new operations to the `ShapeInterface` and implement them in all shape classes. + - With this way, the program can better utilize the support offered by the compiler and the language types for describing the operational logic. + +- The expected result is a summary of all area and boundaries of all patterns, it means there is something that has same operations (`area()`, `boundaries()`) with `Circle`, `Triangle`, `Quadrilateral` and it is a composite of them + + -> + - We have a `CompositeShape` class that also implements the `ShapeInterface`. + + +Next requirement: +> - The number of shapes could also vary from zero to an arbitrarily large number. + +-> It means the `CompositeShape` class may contain multiple shapes. \ No newline at end of file