Write code that reads a string from the keyboard and uses it to set the variable myTime of type TimeOfDay.Use try–catch blocks to guarantee that myTime is set to a valid time.
Write a class TimeOfDay that uses the exception classes defined.Give it a method setTimeTo(timeString) that changes thetime if timeString corresponds to a valid time of day. If not, it should throw an exception of the appropriate type.
Derive exception classes.Each new class should indicate a specific kind of error. For example, InvalidHourException could be used to indicate that the value entered for hour was not an integer in the range 1 to 12.
That is appropriate for indicating that a time entered by a user is not valid. The time will be in the format hour:minute followed by "am" or "pm."
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.