Starting from:

$29.99

Assignments 05 Object Oriented Programming

CPSC 231 Assignments 05
Problem 1: Object Oriented Programming (Total Marks: 7)
For this problem, you will create a class. You can create any class (For example Fraction, Car, Complex
numbers). Once you have created class answer the following questions.
 What are the attributes (or fields) of the class?
 What is the constructor of the class?
 What are the methods inside the class?
 What is/are the variable that has class level scope?
 What is/are the variables that have object level scope?
 What is the name of the object?
You should create one class that answer each of the above questions. You can write your answer in the
submitted python file
Grading:
Class Created: (1 marks)
Answer questions: (1 * 6 = 6)
Problem 2: Recursion (Total Marks: 3)
Write a recursive function sumRecursive that takes a list of integers as an input, and calculates the sum
of all its values. For example: If the list has elements [1, 2, 3, 4], it will return 10.
You should use recursion to solve this. Do not use loops.
Submission:
After you have completed this assignment, you should have written a total of two Python programs,
saved as .py files. Write your answers of the questions asked in this assignment on the python files.
Please ensure that your files are named descriptively (e.g. UCID-P1.py), so that your TA can easily see
which program is associated with each problem.
Use the University of Calgary Desire2Learn system (http://d2l.ucalgary.ca) to submit your assignment
work online. Log in using your UofC eID and password, then find our course, cpsc 231 l01 and l02, in the
list. Then navigate to Assessments -> Dropbox Folders, and find the folder for Assignment #5 here.
Collaboration
Discussing the assignment requirements with others is a reasonable thing to do, and an excellent way to
learn. However, the work you hand-in must ultimately be your work. This is essential for you to benefit
from the learning experience, and for the instructors and TAs to grade you fairly. Handing in work that is
not your original work, but is represented as such, is plagiarism and academic misconduct. Penalties for
academic misconduct are outlined in the university calendar.
Here are some tips to avoid plagiarism in your programming assignments.
1. Cite all sources of code that you hand-in that are not your original work. You can put the citation
into comments in your program. For example, if you find and use code found on a web site, include
a comment that says, for example:
# the following code is from
https://www.quackit.com/python/tutorial/python_hello_world.cfm.
Use the complete URL so that the marker can check the source.
2. Citing sources avoids accusations of plagiarism and penalties for academic misconduct. However,
you may still get a low grade if you submit code that is not primarily developed by yourself.
3. Discuss and share ideas with other programmers as much as you like, but make sure that when you
write your code that it is your own. A good rule of thumb is to wait 20 minutes after talking with
somebody before writing your code. If you find yourself exchanging code by electronic means,
writing code while sitting and discussing with a fellow student, typing what you see on another
person’s console, then you can be sure that “your” code is not substantially your own, and your
sources must then be cited to avoid plagiarism.
4. Collaborative coding is strictly prohibited. Your assignment submission must be strictly your code.
Discussing anything beyond assignment requirements and ideas is a strictly forbidden form of
collaboration. This includes sharing code, discussing code itself, or modeling code after another
student's algorithm. You cannot use (even with citation) another student’s code.
5. We will be looking for plagiarism in all code submissions, possibly using automated software
designed for the task. For example, see Measures of Software Similarity (MOSS -
https://theory.stanford.edu/~aiken/moss/).
Remember, if you are having trouble with an assignment, it is always better to go to your TA and/or
instructor to get help, than it is to plagiarize.
Grading:
There are total 10 marks for this assignment. If you have completed all the problems, you would get 10
marks. 

More products