You don't add try and catch like that:
switch (option) {
try{
case 1:
...
case 2:
...
case 3:
...
...
case 13:
...
}
} catch (IncorrectGradeException e) {
System.out.println(e.getMessage());
}
}
The
try
...
catch
block needs to surround the whole
switch
, not just the
case
s :
try{
switch (option) {
case 1:
...
case 2:
...
case 3:
...
...
case 13:
...
}
}
catch (IncorrectGradeException e) {
System.out.println(e.getMessage());
}
And do yourself a favour: this would have been a whole load more obvious to you if you'd sorted your indentation out!