Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (curry):

My try-catch block is not working no matter what I do... I have to make my own custom exception class.

OpenStudy (curry):

This is the assignment

OpenStudy (curry):

My work so far.

OpenStudy (curry):

My output

OpenStudy (curry):

I'm having a really hard time figuring out why i'm getting that error...

OpenStudy (hyroko):

Your else statement is throwing the bad guess every time you use a non-number it seems, It is telling you the error is on line 34.

OpenStudy (hyroko):

It seems to be working just fine....You put in "d" which caused your input mismatch exception to throw your bad guess exception.

OpenStudy (hyroko):

But I see what you meant. You meant you needed it to continue after printing the message to the screen. You needed to add a call back to the method if they put in the wrong output, passing it the number of tries they've already done.

OpenStudy (curry):

Oh! so i need to add a call to the method if after throwing the new exception? i'm not sure why the program crashes AFTER catching the exception. Shouldn't it be continuing...

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!