Computer Science – 12.2 Program Design | e-Consult
12.2 Program Design (1 questions)
Login to see all questions.
Click on a question to view the answer
Structure Chart:
The top-level module is 'Area Calculator'. It delegates calculations to specific shape modules.
Level 1:
- Area Calculator: The main module.
- Shape Calculation: Handles the area calculation for different shapes.
Level 2:
- Shape Calculation:
- Calculate Circle Area: Takes the radius as input. Parameters: radius (a float). Returns: area (a float).
- Calculate Rectangle Area: Takes the length and width as input. Parameters: length (a float), width (a float). Returns: area (a float).
- Calculate Triangle Area: Takes the base and height as input. Parameters: base (a float), height (a float). Returns: area (a float).
Relationships:
| Area Calculator calls Shape Calculation. |
| Shape Calculation calls Calculate Circle Area, Calculate Rectangle Area, and Calculate Triangle Area. |