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

Please display the correct code for the following question: Assume a class Windo

ID: 3544047 • Letter: P

Question

                    Please display the correct code for the following question:
                

                

                    
                

                

                    Assume a class Window with a constructor that accepts two integer arguments : width and height (in that order). Declare an array named winarr, consisting of 3                     Window objects , where the first element is an 80x20 window, the second a 10x10 window, and the third a 133x40 window.                 

                

                    
                

                                     Thank you =]

Explanation / Answer

#include<iostream>

using namespace std;

class Window

{

private:

int width;

int height;

public:

Window(int x=0,int y=0)

{

width=x;

height=y;

}

};


int main()

{

//first window element

Window temp(80,20);

//second window element

Window temp2(10,10);

//third Window element

Window temp3(133,40);


//array of three window object 3

Window winarr[3];

winarr[0]=temp;

winarr[1]=temp2;

winarr[2] = temp3;

return 0;

}