Question: P5.2 Given the following student class interface, a) implement all member functions of the class, b) implement all non-member external functions of the class, and

P5.2 Given the following student class interface, a) implement all member functions of the class, b) implement all non-member external functions of the class, and c) write a main() function to generate an output similar to the sample output appeared after the class interface. Notice that not all pre- and post-conditions for functions are provided; some are intentionally left out for you to fill in.

#include

#include

#include

using namespace std;

class student

{

public:

student();

student(string, int, double);

string getName();

// "Accessor" or "accessor function"

// Postcondition: returns the GPA of the calling object

int getCredits();

double getGPA();

void setName(string& str);

// "Mutator" or "mutator function"

// Postcondition: data member name of the calling object has been set to str

void setCredits(int);

void setGPA(double);

void setStuRec(string, int, double);

private:

string name; // Last name only

int credits;

double GPA;

};

// **** External functions for P4.2 ****

void inputStuRec(student& obj);

// prompts the user to enter values to fill obj

// Postcondition: obj is filled with user entered values

void outputStuRec(student& obj);

// Postcondition: contents of obj is displayed

int fillStuArray(student[], int size);

void sortStuArrayByName(student[], int n);

void displayStuReport(student[], int n);

void swap(student&, student&);

bool compareName(student& obj1, student& obj2);

bool compareGPA(student& obj1, student& obj2);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!