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

Consider the class specification below. Write the prototype (i.e. header) of a m

ID: 3546219 • Letter: C

Question

Consider the class specification below.  Write the prototype (i.e. header) of a member function to  overload the insertion operator (i.e. <<). The << operator is to output the data members of an instance of class StudentTestScores into an output stream. Your definition should allow for chaining of output operations (e.g. cout << x << y; where x and y are of type StduentTestScires).

#include <string>

using namespace std;

class StudentTestScores{

    private:

       string studentName;

       float *testScores;  // used to point to an array of test scores

       int numTestScores;  // number of test scores

   public:

       // Class default constructor

// Class copy constructor

// Class destructor

//class accessors

//class mutators

//overloaded insertion operator

// other functions

};

Explanation / Answer

#include <string>

using namespace std;

class StudentTestScores{

private:

string studentName;

float *testScores; // used to point to an array of test scores

int numTestScores; // number of test scores

public:

// Class default constructor

// Class copy constructor

// Class destructor

//class accessors

//class mutators

//overloaded insertion operator

friend ostream& operator<<(ostream& out, const StudentTestScores&);


// other functions

};