Expand All Collapse All


ColorHSB data type
Is HSB format the same as HSV and HSL?
HSB (hue–saturation–brightness) and HSV (hue–saturation–value) formats are the same, but they are different from HSL (hue–saturation–lightness) format.
Can the name of a color contain whitespace?
No. To simplify parsing, you can assume that the color names do not contain whitespace.
How do I throw an IllegalArgumentException?
Use code like the following
throw new IllegalArgumentException("the hue must be between 0 and 359");
Clock data type
How can I implement the toc() method efficiently when Δ is large?
Use the remainder (%) operator.
How do I validate and parse the string argument in the one-argument constructor?
Use various String library functions (such as substring() and length()) and Integer.parseInt(). Note that Integer.parseInt() ignores any leading zeros. For example, Integer.parseInt("09") returns the integer 9.
Does Java have built-in data types for times and dates?
Yes. See LocalTime, LocalDate, and LocalDateTime. Of course, you should implement the Clock data type from scratch.