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

How can I add two constructors and a destructor to the class and create the impl

ID: 3654986 • Letter: H

Question

How can I add two constructors and a destructor to the class and create the implementation of each. One constructor is the default constructor that sets the side to 1. The other constructor will allow the user to initialize the side at the definition of the object. The destructor does not have to do anything but reclaim memory space. Create an object called box1 that gives the value of 9 to the constructor at the definition. Add output statements so that the following is printed in addition to what is printed in the following code.

Explanation / Answer

you may also download the code from http://www.2shared.com/file/cFu1ugNK/SQUARE.html #include //using namespace std; /* FILL IN THE CODE TO DECLARE A CLASS CALLED Square. TO DO THIS SEE THE IMPLEMENTATION SECTION.*/ class Square { private: float side; public: void SetSide(float) ; float findArea(); float findPerimeter(); Square() { side=1; } Square(float s) { side=s; } ~Square() { } }; int main() { Square box; // box is defined as an object of the Square class float size; // size contains the length of a side of the square /* FILL IN THE CLIENT CODE THAT WILL ASK THE USER FOR THE LENGTH OF THE SIDE OF THE SQUARE. (This is stored in size)*/ cout
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