Please follow the instruction and use simple C++ to solve this problem. Question
ID: 3794969 • Letter: P
Question
Please follow the instruction and use simple C++ to solve this problem.
Question 2: (50 points) Implement a class called WboleNumber. This class will be used to store any integer from -1,000 to 1,000. The class also has the functionality to translate the value into an English description of the number. For example, if -489 is stored in a WboleNamber object then its value would be translated int number: The class should also have the following functionalities: two constructors: i. A default constructor that initializes number to 0 ii. A constructor that accepts an integer and uses it to initialize the number. If the integer passed is greater than 1,000 then nmber should be initialized to 1,000. If the integer passed is less than -1,000 then number should be initialized to -1,000.Explanation / Answer
#include<iostream.h>
#include<conio.h>
class def;
class abc
{
int x;
public:
void getdata();
void display();
friend int sum(abc,def);
};
class def
{
int y;
public:
void getdata();
void display();
friend int sum(abc,def);
};
void abc::getdata()
{
cout<<"Enter x value= ";
cin>>x;
cout<<endl<<endl;
}
void abc::display()
{
cout<<"X value is "<<x<<endl<<endl;
}
void def::display()
{
cout<<"Y Value is "<<y<<endl<<endl;
}
void def::getdata()
{
cout<<"Enter y value= ";
cin>>y;
cout<<endl<<endl;
}
int sum(abc one,def two)
{
int temp;
temp=one.x+two.y;
return(temp);
}
void main()
{
abc m;
def n;
clrscr();
m.getdata();
n.getdata();
m.display();
n.display();
int t=sum(m,n);
cout<<"Sum of two private values is = "<<t;
getch();
}