Note AcademyNote Academy

Computer Science · May / June 2025 · Paper 22 · Question 10

0478

As printed in the paper

The question as text

A program is required to allow students to calculate the volume of a number of standard three-dimensional shapes. It will use functions to allow other shapes to be added in the future. base base depth depth height height radius Cuboid volume=baseðdepthðheight Triangular prism Sphere 1 2 ðbaseðdepthðheight volume= 4 3 ðPiðradiusðradiusðradius volume= Pi is a constant with value 3.142 Write a program that meets the following requirements: • Output a menu to ask the user for an input to indicate the shape for which a volume needs to be calculated, from the three shapes given or if they want to stop the program. The program must validate the input. • Input the data needed to calculate the volume of the chosen shape, based on the given formulae. • Create one function for each shape to calculate and return the volume using the given formulae. Each function uses the input data as parameters. • Output the volume in the main program, rounded to two decimal places. The program continues until the user inputs the stop option from the menu. You must use pseudocode or program code and add comments to explain how your code works. All variables and constants used must be declared for this algorithm. All inputs and outputs must contain suitable messages.

Read automatically from the paper; the printed page above is exact.

Show the answer and mark scheme

Due to an issue with this question, the question has been removed from the question paper.

Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.