Team LiB
Previous Section Next Section


All of the following exercises involve making modifications/extensions to the SRS code presented in this chapter. If you haven't already done so, please download the code from the Apress web site in preparation for these exercises; see Appendix D for details.

  1. Expand the SRS.cs class's Main method to represent a second semester's worth of course registrations. (Hint: this will require a second instantiation of the ScheduleOfClasses class.)

    • Change the grades received by some Students in the first semester to failing grades, then attempt to register the Student for a course in the second semester requiring successful completion in a previous semester.

    • Try registering a Student for a course in the second semester that he or she has already successfully completed in the first semester.

  2. Improve the logic of the AddPrerequisite method of the Course class to ensure that a Course can't accidentally be assigned as its own prerequisite.

  3. Improve the logic of the AgreeToTeach method of the Professor class so that a Professor can't accidentally agree to teach two different Sections that meet at the same day/time.

  4. Implement a CancelSection method for the Course class, and then correct the erroneous logic of the ScheduleSection method having to do with the manner in which Section numbers are assigned. (Hint: introduce a static field to the Course class for this purpose.)

  5. The Enroll method of the Section class doesn't take into account the fact that a Student may simultaneously be registered for a course and its prerequisite. Modify this method to allow for this possibility.

  6. The PostGrade method of the Section class makes mention of the need for an EraseGrade method, in the event that a Professor wishes to change his or her mind about the grade that has been issued to a Student; create the EraseGrade method.

  7. Advanced exercise: Modify the ScheduleSection method of the Course class to prevent two Sections from being scheduled for the same classroom at the same day/time.

  8. Advanced exercise: The Display method of the ScheduleOfClasses class doesn't presently list Sections in alphabetically sorted order by course name; make whatever changes are necessary to do so.

Team LiB
Previous Section Next Section