首页 > > 详细

CSc 110辅导、data留学生辅导、Python语言讲解、辅导Python编程语言辅导Python编程|解析Haskell程序

CSc 110 Assignment 10:
Classes and instance data
Learning Outcomes:
When you have completed this assignment, you should understand:
• Write instance methods
• Write methods that operate on objects and lists of objects
How to hand it in:
• Submit 3 files: assignment10.py, date.py and pet.py file in CourseSpaces before the deadline.
Grading:
• Late submissions will be given a zero grade.
• The files you submit must be named assignment10.py, date.py and pet.py.
The filenames must be EXACT for them to work with our grading scripts. Errors in the filenames will
result in a zero grade.
Example mistakes often made by students include but are not limited to: spelling errors, different case
letters, space characters and incorrect extension (not using .py)
• Your function names and the order of your function arguments must match EXACTLY as specified in
this document or you will be given a zero grade. Use the example tests we give you to ensure your
function header is correct.
• We will do spot-check grading in this course. That is, all assignments are graded BUT only a subset of
your code might be graded. You will not know which portions of the code will be graded, so all of your
code must be complete and adhere to specifications to receive marks.
• Your code must run without errors with Python 3. If you tested your configuration with setup.py file this
would have verified you are using Python 3. Code that generates errors cannot be tested and will be given
a zero grade.
Marks will be given for…
• your code producing the correct output
• your code following good coding conventions (as discussed in lecture and videos)
o import statements are at the top of your program
o docstring formatted comments within your function that include
§ a statement describing the purpose of the function
§ example calls/output for that function
o Proper use of variables: meaningful names, store intermediate computation results, and eliminate
redundant computation
o Proper use of named constants where appropriate – constants defined at the top of your program,
after any import statements
Reminder: Your assignment code is to be designed and written by only you and not to be shared with anyone
else. See the Course Outline for details surrounding the policies on Academic Integrity.
Getting started:
• Download the provided starter files date.py, pet.py and assignment10.py and the provided
input files that are used by the tests in the program.
NOTE: CourseSpaces does not allow us to upload an empty file. You should create an empty file called
empty.CSV as input to tests provided.
• Familiarize yourself with the code provided in date.py and pet.py You will design a function in
each of date.py and pet.py according to the specification given below.
• Complete the implementation for the incomplete functions in assignment10.py according to the
documentation with the file. You must understand how to call the instance methods within the Date and
Pet classes in order to complete these function designs.
Method Specifications
In the given specifications we have omitted examples as coming up with those examples is part of the problem
solving process. Feel free to use the forum to clarify any ambiguities that you encounter in the specifications
when trying to establish your examples. Don’t forget your FULL documentation
1. Within date.py implement a method called is_after that takes as arguments the hidden reference to the
Date instance itself (self) and an additional instance of a date (other).
The function should return True if the date represented by self is after that represented by other in the calendar
and False otherwise.
2. Within pet.py implement the __eq__ method so that it overrides the existing implementation
automatically inherited. When your implementation is complete, when an instance of a Pet is compared to
another Pet using == it should return True if the name, species and birthdate of the two Pet instances are
the same and return False otherwise.
Note: the header of this function must have the correct function name and number of arguments for this
overriding to work. See date.py for an example of this.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!