Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 13 Weeks Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hello. I have a problem to modify RandomNumberGuesser and NumberGuesser and GessingProgram java files for using Exceptions.
Task:
NumberGuesser classes: When you worked on the NumberGuesser classes you might have noticed that the higer() and lower() methods can be called until there are no possible values left for the guesser to guess. In this case it seems fair for a NumberGuesser to throw an IllegalStateException.
Â
If the NumberGuesser classes were upgraded in this matter then it would be possible to add some exception handling code to the number guessing game so that the users could be notified when the guesser has caught them cheating.
Â
Add code to the higher and lower methods of both the NumberGuesser and RandomNumberGuesser class. Add a try-catch block to your number guessing game so that the user is notified if the sequence of âhâ and âlâ responses is untenable. Feel free to use the code in NumberGuessers.zip as the starting point for your modifications.
Attachments: