Question: Problem 2a: (8 points Write a C++ program that inputs the length and width of two rectangles in integers) representing a house and a garage.

Problem 2a: (8 points Write a C++ program that inputs the length and width of two rectangles in integers) representing a house and a garage. Write a function that uses Call-by-Value int rectArea (int len, int wid) that returns the area of a rectangle with length len and width wid. Divide the area of the garage by the area of the house and multiply by 100 to determine the percentage (int). Enter your name as a Global variable and all other variables should be local variables in main or rectArea Area = length*width Percentage = 100* GarageArea/HouseArea Length of House (ft): 50 Width of House (ft): 60 Length of Garage (ft): 10 Width of Garage (ft):20 Sample Output (Your name will replce mie) The house is 3000 square feet The garage is 200 square feet Cindy's garage is 6 percent of her house Problem 2b: (7 points) Draw the memory and run-time stack when rectArea is called. This should look similar to Fig 2.17g in the textbook and ALL of your variable names should be shown including name. Remember, local variables are stored on the stack and global variables are stored in fixed memory. You
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
