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

2. Complete the following class declaration and class implementation as instruct

ID: 3560870 • Letter: 2

Question

2. Complete the following class declaration and class implementation as instructed by the comments: // Declaration for class Rectangle class Rectangle { public: // a. Declare a constructor (prototype) that takes 2 int arguments // b. Declare a member function (prototype) named area that takes no // arguments and returns an int result. private: // c. Declare two int data members to store width and height }; // Implementation of class Rectangle // d. Implement the constructor to initialize the data members // e. Implement the area function to return the area of the rectangle

Explanation / Answer

#include using namespace std; class Rectangle{ public: Rectangle(int,int); int Area(); int height; int width; }; Rectangle::Rectangle(int a,int b){ height=a; width=b; } int Rectangle::Area(){ return height*width; } int main(){ Rectangle R(4,5); cout