15.13. Exercises
Review all of the code associated with the SRS as produced in this chapter, and cite all cases where error handling could be improved.
Use the test scaffold provided in the CourseCatalog class to test the ReadCourseCatalogData and ReadPrerequisitesData methods of that class against all of the following error situations in either the CourseCatalog.dat or Prerequisites.dat files. Edit these files to introduce the following problems one by one, and then run the code to see what happens:
The course name is missing from one of the records in CourseCatalog.dat (i.e., the record only contains two fields instead of three).
The value for credits (the third field in a record) in CourseCatalog.dat is a nonnumeric value, such as "X".
The
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access