Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxxviii Special Issue On Database And Expert Systems Applications Lncs 11250

Authors: Abdelkader Hameurlain ,Roland Wagner ,Sven Hartmann ,Hui Ma

1st Edition

3662583836, 978-3662583838

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago