Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

=+7 How has the COVID-19 pandemic impacted the operations of IHRM?

Answered: 1 week ago