Most of what you need to know to complete today's activity is covered in appendix D of our textbook. The section on Classes in the Python tutorial is also quite clear.
You may also want to refer to the documentation for
the datetime
class from Python's standard
library: http://docs.python.org/2/library/datetime.html.
You should use this class to represent the date and time
information in the classes below. Take a look at the
file datetime_demo.py for an
example of how the class is used.
main
function
for testing the classes that you will create below. Don't forget to
include a call to main
.
day(): int
indicates that
the day
method will return an integer
value. conflicts(other:Event): bool
indicates
that the conflicts
method expects an Event
argument and returns a boolean. Python will not enforce these
types and you don't need to enforce them either. In
this case, the types are just indicating our expectations.
super(SubClassName,self).__init__([ARGS])Where
SubClassName
is the name of the subclass, and [ARGS]
represents the arguments expected by the constructor of the
superclass (excluding self
).
There is nothing to hand in for this assignment. Make sure that you save a copy of your code. If you worked with a partner, make sure both of you get a copy.