/** * Write a description of class time1 here. * * @author (Muhammad Bagus Istighfar) * @version (14.10.20) */ public class Time1 { private int hours; private int minute; private int second; public void setTime (int h, int m, int s) { if ((h >= 0 && h<24) && (m>= 0 && m<60) && (s>=0 && s<60)) { hours=h; minute=m; second=s; } else { throw new IllegalArgumentException( "hour,minute and/pr second was out of range"); } } public String toUniversalString() { return String.format("%02d: %02d: %02d", hours,minute,second); } public String toString () { return String.format("%d:%02d:%02d %s", (( hours == 0 || hours==12) ?12 : hours%12),minute , second, (hours<12 ? "AM" : "PM")); } }