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

Write a C++program that do the following: a. Define a class called Calculator. b

ID: 3614379 • Letter: W

Question

Write a C++program that do the following:

a. Define a class called Calculator.

b. Declare the object Cal of type Calculator.

c. Define a member function Display_sum that receive two intNumber1 and Number2   then print the sum of these twonumbers.

d. Define a member function Display_multiply that receive two intNumber1 and Number2 then print the multiplication of these twonumbers.

e. Test your functions. Write a C++program that do the following:

a. Define a class called Calculator.

b. Declare the object Cal of type Calculator.

c. Define a member function Display_sum that receive two intNumber1 and Number2   then print the sum of these twonumbers.

d. Define a member function Display_multiply that receive two intNumber1 and Number2 then print the multiplication of these twonumbers.

e. Test your functions.

Explanation / Answer

classcalculator{

public : int a,b;
calculator(){}   
      void Display_sum()
      {
         cout<<"please enter the first no";
         cin>>a;
         cout<<" please enter the second no";
         cin>>b;
         cout<<"the answer is "<< a+b<<' ';}
      
       void Display_multiply()
      {
         cout<<"please enter the first no";
         cin>>a;
         cout<<" please enter the second no";
         cin>>b;
         cout<<"the answer is "<< a*b<<' ';}
     
     
      };
main(){
      
calculator cal; //object of the class
      cal.Display_sum();// test of firstfunction
      cal.Display_multiply();// test ofsecond function
      
      
       system("pause");
      
      
      
       }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote