a. Write a statement to declare a pointer variable of type Rectangle. Name it one. b....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a. Write a statement to declare a pointer variable of type Rectangle. Name it one. b. Write a statement to instantiate the Rectangle class and assign the address of the object to pointer one. The Rectangle object is located at (2.5, 3.5) and its length and height of are 150 and 120, respectively. The color used to paint the rectangle is Blue. c. Refer to the pointer one and its pointee. Draw the memory diagram to show the content of the pointer one and its pointee. Indicate which part is in the activation record and which part is on the heap. d. Write a statement to free the space of the Rectangle object which is the pointee of one. e. Write a statement to declare an array of 10 pointers to objects of type Rectangle. Name it rectangles. f. Write a statement to instantiate the Rectangle class and assign its address to the last pointer of the rectangles array. The Rectangle object is painted by Brown and located at (0, 0). Its length and height are 300 and 400, respectively. Write a statement to copy the address of the pointee of one to the 7th Rectangles array. Write a statement to check to see if the Rectangle object pointed to by the first pointer in the Rectangles array has an area larger than 1,000. i. (12 points) Assume two points to an array of 20 Rectangle objects which have various contents. Write a program segment to find the most left x coordinate of all Rectangles in the array. g. h. class Rectangle ( private: Data Type Needed double x; double y; double length; double height; string color; public: // x at upper left corner of the rectangle // y at upper left corner of the rectangle // length of the rectangle // height of the rectangle // color of the rectanble Rectangle (double init x = 0.0, double init_y= 0.0, double getX(); double getY(); double getLength(); double getHeight (); color getColor(); }; // class Rectangle double init_length = 100, double init_height = 50, color init_color = "Red"); a. Write a statement to declare a pointer variable of type Rectangle. Name it one. b. Write a statement to instantiate the Rectangle class and assign the address of the object to pointer one. The Rectangle object is located at (2.5, 3.5) and its length and height of are 150 and 120, respectively. The color used to paint the rectangle is Blue. c. Refer to the pointer one and its pointee. Draw the memory diagram to show the content of the pointer one and its pointee. Indicate which part is in the activation record and which part is on the heap. d. Write a statement to free the space of the Rectangle object which is the pointee of one. e. Write a statement to declare an array of 10 pointers to objects of type Rectangle. Name it rectangles. f. Write a statement to instantiate the Rectangle class and assign its address to the last pointer of the rectangles array. The Rectangle object is painted by Brown and located at (0, 0). Its length and height are 300 and 400, respectively. Write a statement to copy the address of the pointee of one to the 7th Rectangles array. Write a statement to check to see if the Rectangle object pointed to by the first pointer in the Rectangles array has an area larger than 1,000. i. (12 points) Assume two points to an array of 20 Rectangle objects which have various contents. Write a program segment to find the most left x coordinate of all Rectangles in the array. g. h. class Rectangle ( private: Data Type Needed double x; double y; double length; double height; string color; public: // x at upper left corner of the rectangle // y at upper left corner of the rectangle // length of the rectangle // height of the rectangle // color of the rectanble Rectangle (double init x = 0.0, double init_y= 0.0, double getX(); double getY(); double getLength(); double getHeight (); color getColor(); }; // class Rectangle double init_length = 100, double init_height = 50, color init_color = "Red");
Expert Answer:
Answer rating: 100% (QA)
Heres a series of statements and code segments to address your requirements a Declare a pointer vari... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
McDonald's is everyone's favorite fast-food chain (even if you don't admit it!). Consider the process for going through a drive-through, placing an order, and paying for your order, and receiving...
-
STAR Co. provides paper to smaller companies with volumes that are not large enough to warrant dealing directly with the paper mill. STAR receives 100-feet-wide paper rolls from the mill and cuts the...
-
Applebaum Company was formed at the beginning of the current year and purchased $1,200 of supplies during its first week of operations. At the end of the period, it is determined thatonly $300 of...
-
What is the rate of change of the area of a circle (A = r 2 ) with respect to the radius when the radius is r = 3?
-
A storage tank holds methane at 120 K, with a quality of 25 %, and it warms up by 5C per hour due to a failure in the refrigeration system. How long time will it take before the methane...
-
Using the following information: a. The bank statement balance is $3,048. b. The cash account balance is $3,300. c. Outstanding checks amount to $755. d. Deposits in transit are $809. e. The bank...
-
A used conveyor dealer presents an investment package that requires you to pay $\$ 189.99$ a month with $\$ 1,499.00$ down and a nominal annual interest rate of $17 \%$. What is the actual cost of...
-
The following facts relate to McKane Corporation. 1. Deferred tax liability, January 1, 2010, $60,000. 2. Deferred tax asset, January 1, 2010, $20,000. 3. Taxable income for 2010, $115,000. 4....
-
1. Determine the Vave from 0 sec to 3 sec. 2. Determine the Vinst at t= 2 sec. 3. Explain why the answers to questions #1 and #2 are equal. 4. Determine the Vinst at t = 10 sec. 5. Determine the...
-
You have recently been promoted to be director of advertising for the Timkin Tool Company. In your first meeting with Mr. Timkin, he says, Advertising is a waste! Weve been advertising for six months...
-
How to survive a heat wave is the topic to focus on. Which will educate your readers and present the information in an objective manner. The topic should remain anatomy and physiology based with a...
-
Using ISACA publications and the Internet, create a chart the compares COBIT 4.1, COBIT 5, COSO, and SAS 78/AS no. 2. Compare them in the following areas: Audience IC definition IC objectives...
-
Gary and Christina Worden own the Mainstreet Inn, a bed and breakfast, in Parkville, Missouri. A stone wall ran the length of the property behind the inn. A driveway and walkway along the wall were...
-
Congress passed the federal CSA in 1970 with the purpose of establishing a uniform system of regulation of controlled substances in partnership with the states. In this case, an Iowa law has been...
-
Using the state pharmacy laws and rules from your state, how does your state regulate hospital pharmacies? What are some main differences between the state regulations covering community pharmacy...
-
James Thorn had two daughters, Kimberly Tolley and Jamea Wilson. When he visited Jennifer Stolz, an experienced estate-planning attorney, he expressed concerns that Wilson was irresponsible. He...
-
Diane sold the following items during the current year: Item Holding Period Gain/ (Loss) XYZ Stock Held For Investment 3 years $ (6,000) Car Used For Business 11 months $ 2,000 Car Used For Personal...
-
XYZ Inc. a calendar year, accrual basis corporation, had the following items during 2021: Gross revenue from operations Cost of goods sold $420,000 ($180,000) $9,000 LT capital gain .LT capital...
-
Suppose treacle is an array of 10 floats. Declare a pointer that points to the first element of treacle and use the pointer to display the first and last elements of the array.
-
Youve seen how to create mutual class friends. Can you create a more restricted form of friendship in which only some members of Class B are friends to Class A and some members of A are friends to B?...
-
When do you not have to use the keyword return when you define a function?
-
What is EP during Year 1? A. 12,101. B. 6,000. C. 6,000. Mun Hoe Yip is valuing Pure Corporation. Pure is a simple corporation that is going out of business in five years, distributing its income to...
-
If the outlay is lower by the amount that Simpson suggests, the project NPV should increase by an amount closest to: A. 0.09 billion. B. 0.14 billion. C. 0.17 billion. Barbara Simpson is a sell-side...
-
How would you evaluate the comments by Simpsons supervisor about not using the IRR and about using the EAA? The supervisor is: A. incorrect about both. B. correct about IRR and incorrect about EAA....
Study smarter with the SolutionInn App