Question: Step 2: Here are the specifications and sample source code to refresh your recollection: Specifications: Sample Run Create a menu-driven program that finds and Program


Step 2: Here are the specifications and sample source code to refresh your recollection: Specifications: Sample Run Create a menu-driven program that finds and Program to calculate areas of objects displays areas of 3 different objects. 1 -- square The menu should have the following 4 choices: 2 -- circle 1 -- square 3 -- right triangle 2 -- circle 4 -- quit 3 -- right triangle 4 -- quit Radius of the circle: 3.0 If the user selects choice 1, the program Area = 28.2743 should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user selects choice 3, the program should find the area of a right triangle. If the user selects choice 4, the program should quit without doing anything. If the user selects anything else (i.e., an invalid choice) an appropriate error message should be printed. Step 3: Modularize the program by adding the following 4 functions. None of them have any parameters. void displayMenu () void findsquareArea () void findcircleArea () void findTriangleArea (). To do that you will need to carry out the following steps: Write prototypes for the four functions and place them above main. Write function definitions (consisting of a function header and initially empty body) for the four functions and place them below main. Move the appropriate code out of main and into the body of each function. Move variable definitions in main for variables no longer in main to whatever functions now use those variables. They will be local variables in those functions. For example, findsquareArea will need to define the side variable and findcircleArea will need to define the radius variable. All of the functions that compute areas will now need to define a variable named area. Page 2 of 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
