CPSC 231: Mini-Assignment 2c
Due at 4 PM. For assignment due dates see the main
schedule on
the course webpage.
New Concepts to be applied for the assignment
-
Employing debugging
statements to find and fix logic errors.
-
Writing a report
describing the logic error and the fix needed.
- If you want credit for your work:
Do not use any pre-created functions/methods unless you are given explicit
permission to do so. [Generic
list of allowable pre-created code in the form of python libraries].
Since you are writing only minimal code for this assignment it really
shouldn't be an issue for this assignment.
Only new concepts that need to be applied in the assignment are
listed, concepts previously applied in other assignments may need to used in the
implementation of your solution.
You must find the logic error in the starting program [mini_a2c_starting_program.py].
Current version:
-
The 'mood' is set to a default value in the
starting function.
-
As the name implies the purpose of the 'changeMood'
to allow the mood to be changed (even after the function ends).
-
If the mood is altered then the change should show up in the 'start'
and the 'showMood' functions (but does not
in either case).
Tasks needed:
-
Add a debugging statement: at the very end of the 'changeMood'
function after the user is given the option to change the mood that
shows the mood. (Worth 0.4 GPA)
-
Add a debugging statement: in the 'start'
function that shows the mood immediately after the changeMood function has been
called. (Worth 0.4 GPA)
-
Add a debugging statement: anywhere in the 'showMood'
function that shows current state of the mood. (Worth 0.4 GPA)
-
Make the necessary modifications to the starting code so the mood is set
to the proper state in the 'start' and 'showMood'
functions. Your modifications should not change the main purpose of each
function i.e. you can't implement an impropriate solution where the function
for these three functions has been moved into a single function. (Worth
1.0 GPA - 0.5 for each change)
-
start() should call the other functions.
-
The change should allow the user's change to the mood to persist
after the function ends.
-
The
show() function only displays the state of the mood after the user
option to change it i.e. it doesn't alter the mood.
-
Write a brief report of the following (Worth 1.8 GPA):
-
what were the logic errors (Worth 0.7 GPA),
-
how they were fixed (Worth 0.7 GPA),
-
and how the debugging statements showed where the problems resided (Worth
0.4 GPA).
This report should take the form of header documentation (located at the
very start of the program). Also you should update the authorship and version
number of the starting program after you have modified it.
How to do determine 'how you did' on
an assignment? (Short answer: you can thoroughly test your program and become
familiar with non-functional requirements)
Program functionality (implementing working
program features)
-
Test your program: Because the
assignment description (along with required features) is posted ahead of
time if you test your program thoroughly before submitting the final
version then you should get a pretty clear idea of "how you will do".
Style and documentation (non-functional assignment requirements)
- To keep the marker's workload reasonable and to reduce marking time
unless otherwise specified in the description these things will not
factor into the grading of mini-assignments.
Although it won't affect your grade for mini-assignments you should still
practice applying good style in your solution as well as writing
documentation. It will keep your skills for the full assignments (when you will
be graded on these things) and get you used to having good habits.
- Naming conventions: You should employ
good naming conventions for identifiers (variables and constants) as covered
in the "Introduction to programming" section of the course.
-
Your file must be specifically
named as specified under the specific point [Naming
the file] under the "Marking and grading" heading.
- Named constants should be used as appropriate.
- Python documentation: This should be
specified in the header of the program (very top of your program in the form
of Python documentation). The basics of documentation were covered in the
"Intro to programming" section of the course. Later sections may include
additional details.
- Identifying
information:
All assignments should include contact information (full name, student
ID number and tutorial section [Here's
a Link
if you don't know how to find this information])
at the very top of your program.
- Program version.
(version date or version number).
- Under the
version you should specify which assignment features were
implemented in that version. An example covering the use of program
versioning and documentation was covered in the "Introduction to
programming" lectures.
-
Any program limitations or weaknesses.
- In general: The program output and the
program code itself (python program) must be properly aligned and formatted
including whitespace as needed to group related parts and separate sections
(which again was covered in the "Intro to programming" lectures of the
course. Additional requirements in the formatting of output may be included
in the [Functional
requirements] section of the assignment.
- What to submit:
If your submission won't run using Python 3.x on any computer then it won't be
awarded credit.
It's up to you if you wish use a graphical program builder other than IDLE (or another development
environment rather than a simple text editor) to write/run your programs but
regardless you must submit your program in the form of a text ".py"
file or files. Also if you run into problems using another
editor then you may be "on your own" because we only have the ability to
support one development tool which is IDLE.
-
All computer users: Be careful that you actually
submit the file containing your program and not a related file, here's one
example of a problem: operating systems sometimes create a "lock file"
[Description of a lock file for Windows users] [Description for UNIX users -
may apply to MAC-OS].
- Tam's brief explanation
of a lock file: These files are created when
a file is being edited to prevent multiple users or programs from trying to
edit that file. (Names of lock files typically include the file being edited
but include a tilde character in the name e.g. the file being edited is 'a1.py' so
the lock file is named '~a1.py'. Because the lock files do not contain the
actual data take care that you don't accidentally submit the lock file
instead of the file (some students have actually done this).
- Windows users: take care that you don't accidentally submit a
[shortcut to a
file] instead of the actual file. (Check the file name and compare the file
size to your original file. Simply downloading the shortcut file as a test
won't work because that shortcut will work on your computer but not on
anyone else's machine and this may mean your work won't be graded.)
- MAC-users: this
operating system has an equivalency to Windows shortcuts (e.g. symbolic
links but since creating them is a little more involved, typing at a command
line "ln
-s <target file name>" it's
less likely that this problem will come up).
Naming the file containing your program:
You must rename the starting program to a file called "mini_a2c_SOLUTION.py"
Before the due
date, late assignments or
components of assignments/assignment extensions: Due dates
are strict and extensions require acceptable documentation in order to get permission
from the [course
instructor]. If/when permission is awarded for a late submission then I
will let the marker know that the regular penalty will not be applied (so
when ask for an extension I need to know the name of that person).
Alternate submission mechanisms to D2L (non exhaustive list of examples: email,
uploads to cloud-based systems such as Google drive, time-stamps, TA
memories) cannot be used as alternatives if you have forgotten to submit
work or otherwise have not properly submitted into D2L. Only
files submitted into D2L by the due date is
what will be marked,
everything else will be awarded no credit. The final cut off date after
which full assignments will not be accepted is after the [maximum
progressive penalty (listed below)] can
be applied.
Questions or concerns about grades after they have been released:
Assignments will be marked by your tutorial instructor (the "Teaching
Assistant" or "TA") for your
tutorial section. When you
see your assignment grades the marker is the person should be directing your questions towards.
If you still have question after you have talked to your TA, then you can
of course talk to your course
(lecture) instructor but
please indicate in your email that you first contacted your TA before going
into your concerns.
If you don't know which tutorial section
you are officially registered in then you can find this information in the
Student Center in the [PeopleSoft
university portal].
-
How you will be graded
for mini assignments.
Since the grading for mini-assignments is often simple you find any
feedback in (unlike full assignments a separate grading spreadsheet is not
needed) in D2L under Assessments->Dropbox and
then clicking on the appropriate assignment link.
Collaboration:
Assignments must reflect individual work;
group work is not allowed in this class nor can you copy the work of others.
Some "do nots" for your solution: don't publically
post it, don't email it out, don't show it to other students;
or even verbally discuss solutions to any graded work (i.e. you can't do this in
an exam so you can't do this for assignments).
And unless otherwise told you should not use program code for other sources
(which include but aren't limited to: tutors, artificial intelligence programs
such as ChatGPT). For more detailed information as to what constitutes academic
misconduct (i.e., cheating) for this course please read the following [link].
Method of submission:
Reminder: You are to submit your assignment using D2L Here's a UC-IT
created [D2L
help resource] .
Make sure that you [check
the contents of your submitted files]
(e.g., is the file okay or was it corrupted, is it the correct version, it is
the correct file etc.). It's your responsibility to do this! (Make sure
that you submit your assignment with enough time before it comes due for you to
do a check). If don't check and there were problems with the submission then you
should not expect that you can "learn your lesson" and simply resubmit Whatever
you submitted into D2L by the final due date (and due time) is what will be marked.
-
Do not use compression utilities (such as zip) or archiving utilities
(such as tar) otherwise your submission may not be marked. The space savings
in D2L is not worth the extra time required by the marker to process each
submission.
-
How often can you submit: Multiple
submissions are allowed for this assignment: You can (and really should)
submit work as many times as you wish before the due date.
However only the latest file submitted is the one that will be marked,
everything else will be ignored (because it is not fair to your marker to
sort through multiple versions of your files).
-
What to submit: Python programs only (file name ends in .py)
Any other type of file will be rejected by D2L.
Late submissions
for full assignments when there is no extension granted:
Make sure you give yourself enough time to complete the submission process so
you don't get cut off by D2L's deadline (or your submission will be
automatically flagged as
late by D2L and it will be graded appropriately)..
Submission received: |
On time |
Hours late : >0 and <=24 |
Hours
late: >24
and <=48 |
Penalty: |
None |
-1
GPA |
-No credit
(not accepted)
|
Unless otherwise told you
are to write the code yourself and not use any pre-created functions (or
methods). For most assignments the usual acceptable functions include: print(), input() and
the 'conversion' functions such as int(), float(), str().
In
addition you use functions or methods with text formatting capabilities such as
'format()'
or the 'write()'
method of the 'sys'
library module. You
can use any method that you wish (e.g. using format specifiers or the 'format'
method) to set the precision for the output. Look at the particular assignment description for a list of other
functions/methods that you are allowed to use and still get credit in an
assignment submission. If it's not listed then you should assume that you won't
be able use the function and still be awarded credit.