Total : 30 marks
A program is required to allow learners to calculate the areas of standard two-dimensional
shapes. It will use procedures so that the code is modular and reusable.
Shapes and Their Data
Each shape has the following details:
CIRCLE
Area = Pi * radius* radius
RECTANGLE
Area = Length * Width
Area = ½ *base* height
TRIANGLE
Program Requirements
Output a menu to ask the user for an input to indicate what they want to do and the program
must validate users choice input .The menu is as follows:
1. Calculate the area of a rectangle
2. Calculate the area of a triangle
3. Calculate the area of a circle
4. Stop the program
Each calculation must be done inside a procedure. Each procedure uses input data as
parameters
The program must validate user input for calculations like base, length i.e. The procedure is
only used if input data for the calculations are positive otherwise a message “Invalid input”
must be shown
Output the area rounded off to whole number in the main program
The program continues until the user selects the stop option.
All variables and constants must be declared.
You must use pseudocode and comments to explain your code