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

I have a final in c++ on wednseday and I need some help with the following revie

ID: 3583139 • Letter: I

Question

I have a final in c++ on wednseday and I need some help with the following review questions.

4) For the following questions Let’s we have the following code from
test2.cxx in point/line
#includes namespace etc.
int main()
{
Point x(1.0,2.0);
Line y(x); //creates a line starting at 0,0, going to point x
Line z; //remember makes a line on the x-axis
z=y; //sets the line z equal to y
cout<<“Line z should now be equal to y.”<<endl;
cout<<“here is z”<<z;
cout<<“here is y”<<y;
}
A) What are the names of the CLASSES invoked in this code
B) What are the names of the OBJECTS that belong to the classes in part
a in this code
C)Implement the point constructor that must be created to run this code (in
point .cpp)
D) Implement the Line constructor(s) that must be created to run this code
(read the comments in the code above for constructor guidance)
E) Name the operators that are overloaded if any.

Explanation / Answer

A) Classes invoked are:

POINT,LINE

B)Objects are:

x,y,z

C) Constructor may be like:

Point(float a,float b){

x=a;

y=b;

}

D)

Line(Point a){

x1=0;

y1=0;

x2=a.x;

y2=a.y;

}

E) No operator overloading