How to create Pseudocode for this ?
develop an application to calculate the area and
perimeter of geometric shapes. First the user is asked to enter a letter representing
the shape. We use C for circle, R for rectangle and S for square.
After the user chooses the shape, the program prompts for the appropriate
dimensions of the shape accordingly. For instance, if the user has chosen a square,
the program will ask for a side. If it’s a circle, the program will ask for radius. If
it’s a rectangle, it will ask for length and width.
Upon receiving the appropriate dimensions, the program will calculate the area and
the perimeter of the requested shape and print it on the screen. And again, the code
will ask for another letter. If the user enters ‘Q’ the program terminates.
This program must be implemented using modules.
One run of the program will look like this:
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >S
Please enter the side of the square > 8
The area is 64 and the perimeter is 32
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >R
Please enter the width of the rectangle > 5
Please enter the length of the rectangle > 7
The area is 35 and the perimeter is 24
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >Q
It looks like you're new here. If you want to get involved, click one of these buttons!
Sounds like homework.
You need to write six core functions, returning perimeters and areas of each of the shapes you support, given the parameters which define them.
Write those and test them.
The fiddly bit is validating user input. Users might enter anything, including non-digits, massive values beyond which the machine can represent, negative numbers (you can have a philosophical argument about these). However the function scanf() will do most error-checking for you. Be sure to print an error message is scanf() returns an unexpected value for the number of fields converted.