Question: Suppose you have the following function prototypes in your program: int menu() double rectanglearea(double x, double y) double circlearea(double r) Then a write a program
Suppose you have the following function prototypes in your program:
int menu()
double rectanglearea(double x, double y)
double circlearea(double r)
Then a write a program in which menu() function should ask the user choices with options 1, 2, and -1 inside a loop for which the sentinel value is -1.
After you get the choice from the user, your program should
--ask for length and width, call rectanglearea function, and print the area if the choice is 1,
--ask for the radius, call circlearea function, and print the area if the choice is 2,
--print that you're exiting and exit from the loop if the choice is -1,
--ask for a valid choice and should NOT exit from the loop if the choice is other than 1, 2, and -1.
Hint:
area of rectangle: length*width
area of circle: 3.14*r*r
--I recommend testing your functions first to make sure they are working properly. Then you can start working on your loop.
RUBRIC:
--each function is worth 4 points which makes 12.
--a working loop with appropriate if statements: 8 points.
Please answer whatever u have within 5 mins
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
