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?
-
Fourth, executives need to directly participate in improvement projects not just "support" them .... By observing the successes and failures of improvement programs firsthand, rather than relying on...
-
Watches R Us specializes in designer watches and leather goods. Watches R Us uses the perpetual inventory system. Assume Watches R Us began June holding 10 wristwatches that cost $50 each. During...
-
What parametric curve is described by the function \[\gamma(t)=(t-3)+i(2 t+1)\] \(0 \leq t \leq 2\) ? [What would you do if you were instead considering the parametric equations \(x=t-3\) and \(y=2...
-
Holmes Manufacturing is considering a new machine that costs $250,000 and would reduce pretax manufacturing costs by $90,000 annually. Holmes would use the 3-year MACRS method to depreciate the...
-
Mommyr Hai??dee Inc. as of year??end of 202D has total working capital of P3,D??.??? and 1with a current ratio of 2:1. Non??current asset balance of Pl????? comprised of fixed a...
-
Below are incomplete financial statements for Bulldog, Inc. Required: Calculate the missing amounts. BULLDOG, INC. BULLDOG, INC. Statement of Stockholders' Equity Year ended Dec. 31, 2021 Income...
-
What are two significant issues with organizations relying on the internet for much of their work with customers? What is a justification for each of these issues to provide to your boss with solid...
-
You throw a water balloon hoping to hit your sibling. You throwit at an angle of 30.0 at 9.50 m/s. It ends up leaving your handat a height of 0.500 m above the ground. It completely misses...
-
After listening to the lecture on the use of drone technology reflection paper about your thoughts on this possibly new way of policing. There are 4 videos here for you to use as sources. You may use...
-
bk Gitano Products uses job-order costing and applies overhead cost to jobs based on direct materials used in production (not on the basis of raw materials purchased). Its predetermined overhead rate...
-
Explain each of the following term. Joint Ventures Establishment of new foreign subsidiaries Setting up new business operations in a foreign country
-
You have been provided the following information for REIT A. Please answer all questions below using this information, and building on each question as well. Since this information is about three...
-
20. Taxes and the Cost of Capital. Here is Icknield's market-value balance sheet (figures in $ millions): Net working capital $ 550 Debt $ 800 Long-term assets 2,150 Equity 1,900 Value of firm $2,700...
-
The landing gear of an aircraft with: mass of 2000 kg the spring-mass-damper system Consider that the runway surface is y(t) = 0.2 cos 157.08t stiffness of the spring is 5 x 105 N/m. What is the...
-
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?
-
U.S. Industries has a subsidiary in Switzerland. The subsidiary's financial statements are maintained in Swiss francs (CHF). Exchange rates (\($/CHF)\) for selected dates are as follows: The...
-
Asda is a British supermarket chain owned by Wal-Mart Stores, Inc. Assume that the following data relate to Asda's activities for 2017 (in millions).. Exchange rates (\($/)\) during 2017 are:...
-
Massmart Holdings Ltd. is a South African subsidiary of Wal-Mart Inc., selling high volume, low margin branded consumer goods to customers in twelve countries in Africa. Massmart's accounts are...
Study smarter with the SolutionInn App