Question: Create a new subclass named Clock that inherits from your TimeType class. Like the TimeType class, the Clock class will be used to represent a

Create a new subclass named Clock that inherits from your TimeType class.
Like the TimeType class, the Clock class will be used to represent a 24 hour clock with the addition of three private integer attributes: month, day, and year.
Clock should contain the following methods:
constructor - Instantiates a Clock object and sets the date to 1/1/1980 and the time to 00:00:00
You should create a List class variable of 12 elements that you will reference to determine if the given day is valid for the current month. The days in each month are: Jan 31, Feb 28, Mar 31, Apr 30, May 31 Jun 30, Jul 31, Aug 31, Sep 30, Oct 31, Nov 30, Dec 31. You should use the leapYear() method to determine if Feb. should contains 28 or 29 days. You will use this list to determine if a particular day is valid for a given month. It will be used by the methods below.
leapyear(year)- a class method that returns True if the parameter is a leap year, otherwise returns False. A year is a leap year if it is divisible by 4, but not by 100(except if divisible by 400.) Said another way: Any year that is evenly divisible by 4 is a leap year, except century years that are not evenly divisible by 400.
setClock()- Takes 6 integer parameters representing hrs,mins, secs, mon, dy, yr and sets the time and date in the object according to the parameters and returns True provided all parameters are valid, otherwise does nothing and returns False.
increaseDay()- Increases the day by one. This method should also adjust month and year if necessary.
decreaseDay()- Decreases the day by one. This method should also adjust month and year if necessary.
increaseSecond()- Increases the second by one. This method should also adjust the minutes, hours, day, month and year if necessary.
decreaseSecond()- Decreases the second by one. This method should also adjust the minutes, hours, day, month and year if necessary.
__str()__- Returns the time in the format "mm/dd/yyyy HH:MM:SS AM/PM"
Notes:
- All methods should handle leap years correctly. It is easiest to call the leapyear() method at the beginning of the increase, decrease, and set methods and adjust the number of days in Feb before proceeding.
- Write your own client to test the implementation of your Clock class. Make sure you test all methods. For example, increase and decrease the seconds that roll forward and backward from one year to the next, and from February to March in both a leap and non-leapyear.
in python lang. please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!