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, e.g. if the 2 years are 2020 and 2010, the new year value should be 2015.The month of the receivedMyDateshould be subtracted from the current object. If the calculated month is less than 0, it should default to a value of 1.The day of the receivedMyDateshould be subtracted from the current object. If the calculated day is less than 0, it should default to a value of 1.
An override of the str method that outputs aMyDatein the format day month name year, e.g.1 January 1970.

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 Programming Questions!