The purpose of this lab is to add exception handling to the DoubleList class used in Lab 5. We will use the basic exception handling syntax we learned at the end of lecture on Wednesday.
Copy the fixed implementation file from list_fixed.cpp to a file called lab8.cpp. In lab8.cpp, you are going to an exception-based index operator. This MUST be an index operator that returns a double reference so we can use the index operator to update the list's contents.
First, add an empty exception class above the DoubleList class definition:
Finally, update your main() function to implement the following pseudocode:
allocate a DoubleList with 10 elements (constructor that takes an array and integer) for each element in the list prompt the user for element i read in element i end-for do ask the user for an index they wish to access in the list read the user's response into index set flag to true try print out the requested index catch InvalidIndex output that the index is bad set flag to false while flag is falseThis main() function will let you test that you have done the InvalidIndex exception correctly. It should keep asking for a new index until you give an index between 0 and 9.
Email your completed lab8.cpp to me.