Question: ( 30 ) 1. (C++ Coding) Given the class Student specification and partial implementation (inline function definitions), complete the implementation and develop a driver program

(30) 1. (C++ Coding) Given the class Student specification and partial implementation (inline function definitions), complete the implementation and develop a driver program to test the class main() along with the prntStud() member function must exercise each member function. Include definitions for at least three Student objects, one for each constructor default, 2-parameter, and 4-parameter.

enum srank { FROSH, SOPH, JR, SR, OTHER };

class Student // Student Class Declaration

{

private:

string name; // student's name

int id; // ID number

string major; // major

srank rank; // student's rank in school

public:

Student() : name(""), id(0), major(""), rank(FROSH)

{ } // default ctor sets strings to null and id to zero

Student(string n, int no) : name(n), id(no), major(""), rank(FROSH)

{ } // 2-parameter ctor

Student(string n, int no, string m, srank r) : name(n), id(no), major(m), rank(r)

{ } // 4-parameter ctor

void setName(string n) // mutators

{ name = n; }

void setId(int no)

{ id = no; }

void setMajor(string m)

{ major = m; }

void setRank(srank p)

{ rank = p; }

string getName() // accessors

{ return name; }

int getId() const

{ return id; }

string getMajor() const

{ return major; }

srank getRank() const

{ return rank; }

void prntStud() const;

};

/* Sample output:

Name: Sally Smrt

ID Number: 47899

Major: Accounting

Class Rank: Junior

Name: Mark Jones

ID Number: 39119

Major: Business

Class Rank: Senior

Name: Jill Rogers

ID Number: 81774

Major: Computer Science

Class Rank: Sophomore */

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!