Question: a. Write a statement to declare a pointer variable of type Rectangle. Name it one. b. Write a statement to instantiate the Rectangle class

a. Write a statement to declare a pointer variable of type Rectangle. Name it one. b. Write a statement to class Rectangle ( private: Data Type Needed double x; double y; double length; double height; string color; 

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");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a series of statements and code segments to address your requirements a Declare a pointer vari... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!