At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your **free** account and access **expert** answers to this and **thousands** of other questions.

I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the **expert** answer you'll need to create a **free** account at **Brainly**

#include
using namespace std;
class Operation
{
private:
int answer;
int numberA;
int numberB;
public:
int addition(int numberA,int numberB);
int subtraction(int numberA,int numberB);
int multiplication(int numberA,int numberB);
int division(int numberA,int numberB);
int getNumberA();
void setNumberA(int numberA);
int getNumberB();
void setNumberB(int result);
void printOnScreen(int answer);
};
int Operation::getNumberA()
{
return numberA;
}
void Operation::setNumberA(int A)
{
numberA=A;
}
int Operation::getNumberB()
{
return numberB;
}
void Operation::setNumberB(int B)
{
numberB=B;
}
int Operation::addition(int numberA,int numberB)
{
return (numberA+numberB);
}
int Operation::subtraction(int numberA,int numberB)
{
return (numberA-numberB);
}
int Operation::multiplication(int numberA,int numberB)
{
return (numberA*numberB);
}
int Operation::division(int numberA,int numberB)
{
return (numberA/numberB);
}
void Operation::printOnScreen(int answer)
{
cout<>choice;
switch(choice)
{
case 1:
o.addition(numberA,numberB);
break;
case 2:
o.subtraction(numberA,numberB);
break;
case 3:
o.multiplication(numberA,numberB);
break;
case 4:
o.division(numberA,numberB);
break;
default:
cout<<"Wrong choice"<

private member* `answer'
something like
void Operation::printOnScreen()
{
cout << answer << endl;
}

with that diagram, it looks like you are just missing the getAnswer and setAnswer methods.

yep. bt am trying to include it. am totally confused.

ya I knw that. bt it is given in the class diagram as void getAnswer.

that's confusing then; getter methods are supposed to return something, no? :(

ya u r right.
and also i dnt knw vt to include in printOnScreen() .:(

#include
using namespace std;
class Arithmetic
{
private:
int answer;
int numberA;
int numberB;
public:
int addition(int numberA,int numberB);
int subtraction(int numberA,int numberB);
int multiplication(int numberA,int numberB);
int division(int numberA,int numberB);
int getNumberA();
void setNumberA(int numberA);
int getNumberB();
void setNumberB(int result);
int getAnswer();
void setAnswer(int result);
void printOnScreen();
};
int Arithmetic::getNumberA()
{
return numberA;
}
void Arithmetic::setNumberA(int A)
{
numberA=A;
}
int Arithmetic::getNumberB()
{
return numberB;
}
void Arithmetic::setNumberB(int B)
{
numberB=B;
}
int Arithmetic::addition(int numberA,int numberB)
{
return (numberA+numberB);
}
int Arithmetic::subtraction(int numberA,int numberB)
{
return (numberA-numberB);
}
int Arithmetic::multiplication(int numberA,int numberB)
{
return (numberA*numberB);
}
int Arithmetic::division(int numberA,int numberB)
{
return (numberA/numberB);
}
int Arithmetic::getAnswer()
{
return answer;
}
void Arithmetic::setAnswer(int result)
{
answer=result;
}
void Arithmetic::printOnScreen()
{
cout<>choice;
switch(choice)
{
case 1:
a.addition(numberA,numberB);
break;
case 2:
a.subtraction(numberA,numberB);
break;
case 3:
a.multiplication(numberA,numberB);
break;
case 4:
a.division(numberA,numberB);
break;
default:
cout<<"Wrong choice"<

Bt I dnt get the expected output. Dnt knw y.:(

What is the output you expect?

BUt why did you declare another answer varible in main () ??

If I change it like this I get an error saying that answer is private.

Got it. It should be
answer=a.addition(numberA,numberB);
setAnswer(answer);
Now it should be fine

bt it reports an error as answer undeclared

Sorry @ Ajprincess. It should be
answer=a.addition(numberA,numberB);
a.setAnswer(answer);

bt I wrote it as a.setAnswer(answer)

LOL. No problem. I also learnt by making these mistakes :P

U too @agdgdgdgwngo are really helpful. Thanxxxxx a lot.

can u please show with my function declarations?

k thanxxxx a lot. @shivam_bhalla

Sure.:)