Question: 2. Assume given the following class definition: class Rectangular.ot public: Rectangular.t(); lidefault length is I and default width is 1 RectangularLot double len, double wid);
2. Assume given the following class definition: class Rectangular.ot public: Rectangular.t(); lidefault length is I and default width is 1 RectangularLot double len, double wid); void read: // read the length and the width of the lot void setLength double len): // set the new value of the data member length void setWidth double wid): W set the new value of the data member width double getlength(); W returns the length of the lot double get Width: //returns the width of the lot double getArea) Il computes and returns the area of the lot void print: Il prints the length, the width and the area of the lot private: double length: double width: 1: 1. Write the definitions of the constructors and the other member functions of this class 2. Write the definition of the derived class of class Rectangularlot named Lot4Sale as follows: a. It has an additional private data member named unitPrice (double precision value). b. In addition to the constructors, it has the following public member functions: double getUnitPricef ) returns the value of the data member unitPrice. void setUnitPrice double uprice ) sets the new value of the unit price. double getPricel) returns the price of the lot (the unit price times the area). c. Member function vold read) is redefined in class Lot4Sale. It reads the unit price in addition the length, and the width 4. Member function void prinel) is redefined in class Lot4Sale. It prints the unit price and the price of the lot (the unit price times the area) in addition to the length, the width and the area. 3. Write the definitions of the constructors (the default unit price is $1000.00), the functions read) and print), and the new member functions of the class Lot 4Sale. 4. Assuming that objects fot1 and fot2 are defined as follows in-main.cpp" file): Rectangular or lot1/80.00, 55). Lot 4Sole lot 2(120, 50, 5000,00): What is the output produced by the following two statements lott print lot2.print You need to create fles Rectangularloth Rectangular and main.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
