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

Consider the definition of the following class: class dumpClass { public: int su

ID: 3533840 • Letter: C

Question

Consider the definition of the following class:

class dumpClass

{

public:

int sum(); //Returns the sum of the private member variables

int multiplication(); //Returns the multiplication of the private member variables

void setVarOne(int x); //Initializes the private member variable var1 to x

void setVarTwo(int y); //Initializes the private member variable var2 to y

void print(); //Prints the values of the private member variables

private:

int var1;

int var2;

};

a. Write the definitions of the member functions as described in the definition of the class dumpClass.

b. Write a test program to test the various operations of the class dumpClass.

Explanation / Answer

a) // Class function implementations (may be defined in any order)

          int testClass :: sum( )

          {

               return x + y;

          }

          void testClass :: print ( ) const

          {                                             // no idea what format the book wants, so I