UML_Class Diagram 1

2

2 votes
Medium
Problem

Convert the following UML class diagram into Java class:

Note: Validate the hour, minute and second values. i.e. hour should be between 0 and 23 and seconds & minute must be between 0 and 59. If any value is invalid then throw an IllegalArgumentException with appropriate error message such as "Invalid Hour" or "Invalid Minute" or "Invalid Second"  and set that value as per the table:

Exception Value Time Value to be set Example
Invalid Hour  00:00:00 if given value is 87:52:23 then time is set as 00:00:00
Invalid Minute  hh:00:00 if given value is 14:75:12 then time is set as 14:00:00
Invalid Second  hh:mm:00 if given value is 17:25:88 then time is set as 17:25:00

 

 

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?