The purpose of this lab is to add exception handling to the DoubleList class used in Lab 5
Copy your solution for Lab 5 or the posted solution for Lab 5 (lab5.cpp) to a file called lab8.cpp. In lab8.cpp, you are going to add exceptions to the index operator.
First, add an 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 integer)
for each element in the DoubleList
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 DoubleList
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 false
This 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.