Question: Remove the indexing-based getSection function from faculty.h and add appropriate declarations of iterator and const_iterator types and associated functions allowing access to a Faculty objects

Remove the indexing-based getSection function from faculty.h and add appropriate declarations of iterator and const_iterator types and associated functions allowing access to a Faculty objects sections.

#ifndef AUTHOR_H #define AUTHOR_H

#include #include #include "section.h"

class Faculty { private:

//** You must not change the private data members of this class, nor //** may you add additional data members. //** //** You may add private functions if you wish.

static const unsigned MAXSECTIONS;

std::string name; //!< The name of the faculty member unsigned numberOfSections; //!< Number of course sections being taught by this faculty member Section* sections; //!< Array of sections being taught by this faculty member

public: //** You may alter the public interface but it must continue to //** compile with the existing, unaltered application code and //** test code.

/** * Construct a Faculty object with empty name and no course sections. */ Faculty();

/** * Construct a faculty member with the given name and no course sections. * * @param theName name to give to this faculty member */ Faculty(std::string theName);

// The Big 3 ~Faculty(); Faculty (const Faculty& fac); Faculty& operator= (const Faculty& fac);

/** * Get the name of the faculty member. * * @return the name */ std::string getName() const {return name;}

/** * Set the name of the faculty member. * * @param theName the name to give to this faculty member. */ void setName (std::string theName) {name = theName;}

/** * How many sections are associated with this faculty member? * * @return number of sections */ unsigned numSections() const { return numberOfSections; } /** * Add a section to the list for this faculty member. Sections are kept ordered * by course number and CRN. * * @param sect a course section * @pre numSections() < MAXSECTIONS */ void add (const Section& sect);

/** * Retrieve the sectionNum_th section associated with this faculty member * * @param sectionNum identifies the section to be retrieved. * @return the desired section * @pre sectionNum < numSections() */ const Section& getSection (unsigned sectionNum) const;

/** * Ordered by name */ bool operator< (const Faculty&) const; bool operator== (const Faculty&) const;

/** * Used by the instructor for testing purposes. */ bool sanityCheck() const; };

/** * Print a faculty member name, followed, one per line, by the sections associated * with this faculty member; */ std::ostream& operator<< (std::ostream& out, const Faculty& a);

#endif

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!