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

Here is the problem: Given a class Window, with integer data members width, heig

ID: 3642919 • Letter: H

Question

Here is the problem:

Given a class Window, with integer data members width, height, xPos, and yPos, write the following two constructors: - a constructor accepting 4 integer arguments: width, height, horizontal position, and vertical position (in that order), that are used to initialize the corresponding members. - a constructor accepting 2 integer arguments: width and height (in that order), that are used to initialize the corresponding members. The xPos and yPos members should be initialized to 0.


I get an error stating my yPos is incorrect

I have tried and this is all I could get


Window(int w, int h, int x, int y)

{
width =w;
height = h;
xPos = x;
yPos = y;
}

Window(int w, int h)
{
width = w;
height = h;
}

Explanation / Answer

Window (int width1, int height1, int horizontal1, int vertical1)
{
width=width1;
height=height1;
xPos=horizontal1;
yPos=vertical1;
}

Window (int width1, int height1)
{
width=width1;
height=height1;
xPos=0;
yPos=0;
}