Code has error in Function 4

Used a function from Sean Deitz Code, It's not working properly yet.
States an unhandled exception. His code was not working completely last
he stated in class. May need to fix something in this part of the code.