Question: Write a program to calculate area of common geometric shapes shown in Figure 1. The program should give the user the option to choose from



Write a program to calculate area of common geometric shapes shown in Figure 1. The program should give the user the option to choose from rectangle, circle, or triangle. Create functions representing each geometric shape which calculates and refer (pass by reference) the value of the area. Add another function to find the smallest and largest area of calculated geometric shapes. The program should also allow the user to repeat the whole process all over again. The sample output is given as in Figure 2. Rectangle Circle A= ab A=ar2 e Triangle A= ah/2 Figure 1: Common geometric shapes Calculate or find min-max area of: 1 Rectangle 2 - Circle 3 - Triangle 4 - Show smallest and largest area Your selection: b Wrong selection! Do you want to repeat the whole process (Y/N): y Calculate or find min-max area of: 1 - Rectangle 2 Circle 3 - Triangle 4 - Show smallest and largest area Your selection: 4 No largest No smallest Do you want to repeat the whole process (Y/N): Y Calculate or find min-max area of: 1 - Rectangle 2 Circle 3 - Triangle 4 Show smallest and largest area Your selection: 1 a: 1 b: 1 Area of a rectangle: 1 Do you want to repeat the whole process (Y/N): y Calculate or find min-max area of: 1 - Rectangle 2 - Circle 3 - Triangle 4 Show smallest and largest area Your selection: 2 r: 2 Area of a circle: 12.568 Do you want to repeat the whole process (Y/N): y Calculate or find min-max area of: 1 Rectangle 2 Circle 3 - Triangle 4 - Show smallest and largest area Your selection: 3 a: 3 h: 3 Area of a triangle: 4.5 Do you want to repeat the whole process (Y/N): y Calculate or find min-max area of: 1 - Rectangle 2 Circle 3 - Triangle 4 Show smallest and largest area Your selection: 4 Largest area is 12.568 of geometric shape Circle Smallest area is 1 of geometric shape Rectangle Do you want to repeat the whole process (Y/N): n Process exited after 31.03 seconds with return value o Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
