Modify the set methods in class Time2 of Fig. 8.5 to return appropriate error values if an attempt is made to set one of the instance variables hour, minute or second of an object of class Time to an invalid value. [Hint: Use boolean return types on each method.] Write a program that tests these new set methods and outputs error messages when incorrect values are supplied.
Please see attachments for full problem details.© BrainMass Inc. brainmass.com March 4, 2021, 7:50 pm ad1c9bdddf
In order to test if user supplies a wrong value for hour, minute and second three private boolean variables were introduced in ...
The solution illustrates how to return error conditions from Java methods using an example (see attachment).