Question: java only 2. Consider a class Time that represents a time of day. It has attributes for the hour and minute. The hour value ranges
2. Consider a class Time that represents a time of day. It has attributes for the hour and minute. The hour value ranges from 0 to 23, where the range 0 to 11 represents a time before noon. The minute value ranges from 0 to 59. a. Write a default constructor that initializes the time to O hours, O minutes. b. Write a private method isValid (hour, minute) that returns true if the given hour and minute values are in the appropriate range. c. Write a method setTime (hour, minute) that sets the time if the given values are valid. d. Write another method setTime (hour, minute, isAM) that sets t if the given values are valid. The given hour should be in the range The parameter isAm is true if the time is an am. time and false othe 3. Write a default constructor and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
