Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AX 0 8 C + + : string toString ( ) { p 1 . toString ( ) + to

AX08
" C++
: string toString(){ p1.toString()+"" to ""+ p2.toString(); }()
2
(-
MoveBy (int deltaX, int deltaY) Segment x (deltaX) y (deltaY)
Segment::
:
#
#include
std
{
:
int x =0;
int y =0;
:
(){}
(int xVal int yVal){
moveBy(xVal, yVal)
}
string toString(){
_(x)+""""+ to_string(y)
}
void moveBy(int xVal, int yVal){
x += xVal;
y += yVal;
}
};
{
:
string toString(){ p1.toString()+"" to ""+ p2.toString(); }()
//
//YOUR_CODE_BELOW
//YOUR_CODE
void moveBy(int deltaX, int deltaY)// xVal yVal
{
p1->moveBy(deltaX, deltaY)
p2->moveBy(deltaX, deltaY)
}
//
(*p1*p2)
{
this->p1= p1;
this->p2= p2;
}
:
*p1
*p2
//YOUR_CODE_ABOVE
//
};
int main()
{
A(00)
B(4,4)
s1(A, B)
cout << s1.toString()<< endl;
s1.moveBy(1,1);
cout << s1.toString()<< endl;
s1.moveBy(0-2)
cout << s1.toString()<< endl;
}
"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Find the dual code C ¥ of the code C. _0.

Answered: 1 week ago

Question

4. Write goals down and regularly monitor progress.

Answered: 1 week ago