Open main menu

CDOT Wiki β

Changes

OPS435 Python3 Assignment 2P

216 bytes added, 17:10, 7 November 2019
Programmer-defined object type: Date object
= Class Requirements =
== Programmer-defined object type: Date object ==* Data Attributes: year, month, and dayas integer
* Method attributes: tomorrow(), yesterday(), day_of_week()
* Operator Overloading:
** '+': perform addition for two Date() object, and one date object and an integer.** '-': perfome substraction for two Date() object, and one date object and an integer
* Special methods:
** __init__(self): Date object constructor
** __repr__(self): return date object as a string in "yyyy-mm-dd" format
** __str__(self): return date object as a string in "yyyy:mm:dd" format
* Supporting function:
** days_to_time(): convert an integer which is n days from epoch (Jan 1, 1970) to a corresponding date object.
== Required Modules and Functions ==
1,760
edits