Question: A method called subtract which receives another MyDate object as a parameter. This method must subtract the received MyDate object from the MyDate object on
A method calledsubtractwhich receives anotherMyDateobject as a parameter. This method must subtract the receivedMyDateobject from theMyDate object on which the method is called. Subtraction should happen as follows:
The calculated year should be the average value of the current objects year and that of the receivedMyDateobjects year, eg if the years are and the new year value should be The month of the receivedMyDateshould be subtracted from the current object. If the calculated month is less than it should default to a value of The day of the receivedMyDateshould be subtracted from the current object. If the calculated day is less than it should default to a value of
An override of the str method that outputs aMyDatein the format day month name year, eg January
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
