Lab 10 Solution



This lab will focus on exception handling. We will be revisiting Assignment 4 to give you some experience with this task. You will write three small classes that extend Runtime Exception.

The Exception classes you will create are listed below. I have also included the message these exceptions should display when thrown.


o Message: Invalid index for addMovieAt.


o Message: Invalid index for getMovieAt.


o Message: Invalid index for removeMovieAt.”

I have placed TODO markers in the MovieCollection class where you will need to throw the correct exception for each method.

You also will need to add a few lines of code to the Junit tests. Read the description by the //TODO


When complete and all Junit tests pass, show your TA to be marked off for this lab.