Question: 11. Write code for toString and toStandardTime. Note: Output has to be identical and include the leading Os. (20 pts) public static void nain(Stringtl ares)
11. Write code for toString and toStandardTime. Note: Output has to be identical and include the leading Os. (20 pts) public static void nain(Stringtl ares) s ) , 08, "hours"); //Output ClockTime t2 - new ClockTime(24 System.out.println(t2.toString)) /1 12:88 AM ClockTime t3 new ClockTime( 8, 5, "hours")i System.out.printin(t3.tostringO) //12:05 AM ClockTime t4- new ClockTime (10, 35, "hours") System.out.println(t4.toString)); // 18:35 AM ClockTime ts - new ClockTime(12, 15, "hours") System.out.println(t5.toString)); // 12:15 PM ClockTime t6-new ClockTime(13, ee, System.out.printin(t6.toString)): "hours"); //81:00 PM ClockTime t9 - new ClockTime (23, 59, "hours") System.out.println(t9.tostring)) // 11:59 PM ClockTime ta - new ClockTime 9, 30, "AM) System.out.println(ta.tostring)) 89:30 AM ClockTime tb - new ClockTime( 5, 81, "P") System.out.printin(tb.tostring)) / 05:01 PM // A ClockTine object represents an hour:minute time in in either standard time such //as 18:45 AM or 86:27 PM or military time such as 18:45 hours or 18:27 hours public class ClockTime ( private int hour; private int minute; private String label- "hours // Constructs a new time for the given hou /Mabel is "AM" or "PM". If the time is in military time, the label is "hours". r/minute. If time is in standard time, the // returns the field values this.hour h; this.minute n this.label-label; toStandardTime); public int getHour) public int getMinute) public String getLabel) f return hour; return minute; return label
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
