Question: Exercise C6 The class Demo2 is defined as follows: class Demo2 public: void setValues (double num I, double num2); // to set the values of
Exercise C6 The class Demo2 is defined as follows: class Demo2 public: void setValues (double num I, double num2); // to set the values of both member variables double getValuel(void): // to return the value of member variable vall double gerValue2(void): // to return the value of member variable val2 double getAverage(): // to compute the average of the values of both variables private: double vall: // the first data member double val2: // the second data member -- function setValues() -- /* set the values of the member variables to the given values void Demo2:: setValues(double num], double num2) vall = num; val2 num2; ----- function getValuel() --- /* returns the value of the first member variable double Demo2::getValue l(void) return vall): --- function gerValue2() -- /* returns the value of the second member variable double Demo2::getValue2(void) return (val2); function getAverage /* compute the average of both values and return it double Demo2:: getAverage(void) return( (valul + valu2)/2): 2011 Gilbert Ndjatou Page 63
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
