0% found this document useful (0 votes)
2 views1 page

Procedures Practice

The document outlines a program that allows users to calculate the areas of standard two-dimensional shapes: circle, rectangle, and triangle. It specifies requirements for a menu-driven interface, input validation, and modular procedures for calculations. The program continues until the user chooses to stop, with all variables and constants declared and pseudocode provided for clarity.

Uploaded by

theslayr.42
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Procedures Practice

The document outlines a program that allows users to calculate the areas of standard two-dimensional shapes: circle, rectangle, and triangle. It specifies requirements for a menu-driven interface, input validation, and modular procedures for calculations. The program continues until the user chooses to stop, with all variables and constants declared and pseudocode provided for clarity.

Uploaded by

theslayr.42
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like