rewrite the indexing-based code in faculty.cpp with iterator-based code.
the modification only in faculty.h and faculty.cpp. don’t do any changes in the rest of the other files.
1- The declaration of the Faculty class has been changed, in the private area, to use a std::list instead of an array as its implementing data structure.
Your task is to follow through on that change, making the necessary alterations to faculty.h and faculty.cpp to make this a working class. The necessary changes have already been made to the unit tests, the Department class, and to the main printSchedule.cpp application.
2- The major difference between lists and the earlier sequential structures that we have looked at is that elements are accessed via iterators instead of integer-based indices. Accordingly, you will need to
a. rewrite the indexing-based code in faculty.cpp with iterator-based code.
b. 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 object’s sections.
3- To improve the usability of the Faculty class, you will also need to add
a. A constructor to allow Faculty objects to be constructed from a course name and a pair of iterators denoting a range of Section values in some arbitrary container.
b. A constructor to allow Faculty objects to be constructed from a course name and an initializer_list of sections.
4- Your code will be evaluated both on its ability to function correctly within the printSchedule
application and on its ability to pass the various unit tests provided.
· In the test report, tests 0…7 test the printSchedule
application. Tests numbered 8…25 check the unit tests.
a. Each even-numbered test checks for correct behavior of the code.
b. Each odd-numbered test checks to see if that same behavior is correct and entails no memory leaks or other common pointer/memory handling problems.
-
list_courseSched.zip