Question: Python* Write a Clock class that measures hours and minutes. Include the following methods: (a) init , str . (b) Overload Addition for both clock-to-clock
Python*
Write a Clock class that measures hours and minutes. Include the following methods: (a) init , str . (b) Overload Addition for both clock-to-clock operations and clock-to-integer operations. If one argument is an integer, the integer is assumed to represent hours. Addition should be commutative! (c) Output should always be rounded to the minutes. (c) Use exception to handle error. If inappropriate values are passed to the constructor, the created clock instance should get a value of 0 hours and 0 minutes. Include sample code that uses your class and demonstrates the use of all methods as well as error handling.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
