CJCoding With Joseph
15free / daySign inCreate account

Clock With Rollover

Write the whole Clock class for a 24-hour clock. The constructor takes hours and minutes as whole numbers and stores them; add_minutes(extra) moves the clock forward: add extra to the minutes, carry total // 60 into the hours, wrap the hours with the remainder operator % 24, and keep total % 60 as the minutes; describe() prints the time as <hours> h <minutes> min. Do NOT write a main block or any top-level test code; the tests construct the class. Input: three lines, the hours, the minutes and the extra minutes, read by the tests as whole numbers and used before calling describe.

Expected Output:

11 h 15 min

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
ClassesOperators
📥 Auto-Input:
10\n50\n25\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.