exercise.class: Report invalid course IDs

Throw an expection when the given construction parameter is not a valid
course ID.
exercise.class: Delete instead of marking inactive

Because of "teacher mistakes" the exercise was just deactivated instead
of deleted. Delete it now.