Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

More Books

Students also viewed these Databases questions