Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a C++ program that inputs the length and width of two rectangles (in in

ID: 640027 • Letter: 1

Question

1. Write a C++ program that inputs the length and width of two rectangles

(in integers) representing a lot size and a house. This should include one 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. Subtract the area of the house from the area of the yard to determine the area of the

lawn (int).

Area = length*width

LawnArea = LotArea - HouseArea

2. Show the memory and run-time stack when rectArea is called.

This can be easily done in Excel or Word (using tables) or even hand drawn and

scanning If required.

Explanation / Answer

2.

#include "Rectangle.h"

using namespace std;

Rectangle::Rectangle ()

{

x=0; y=0;

}

Rectangle::Rectangle (int cx, int cy)

{

x=cx; y=cy;

}

double Rectangle::Area( )

{

return x*y;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote