# Classes
For this assignment you will design and implement your own class. In addition, you will
write a small program that creates and manipulates objects of your class type.
| Part | Section |
|---------------|-----------------------------------------------|
| 1 (in-lab) | [Part 1](#part1) |
| 1 (in-lab) | [Check-in Instructions](#checkin) |
| 2 (lab/home) | [Part 2](#part2) |
| 2 (lab/home) | [Submission Instructions](#submission) |
## Part 1
Because everyone will be implementing different programs and classes, and because only
you fully understand what you want your program to be, you should think carefully through
the design of your program before you start coding. The requirements for the program are
the following:
#### Specification
The class that you design and implement must include the following:
- 3 or more instance attributes
- an `__init__` method (also known as the constructor)
- a `__str__` method
- 4 additional methods
- Of these 6 methods:
* a method with at least two optional arguments (in combination with one or
more regular arguments). This could be the constructor.
* at least one mutator method
* at least one accessor method
* at least one nontrivial method (there's no official definition, but a rough
guideline would be a method requiring an in-line comment)
In addition, your `main` function must:
- create at least 2 objects of your class type
- call every method
- contain a loop
You are encourage to brainstorm with anyone you'd like to get ideas of what
class to design. The actual code, however, will have to be your own, and you
should not implement the same class as anyone you've brainstormed with.
(Hint: a good starting place is nouns.)
#### Checking In
Create the file `classes.py` and start implementing your class. To get
full lab points your code should include:
- a module docstring, describing your class
- docstrings for all of the methods you plan to implement
- the `__init__` and `__str__` methods should be fully implemented
- the `main()` function should create two objects and print information about them using the `__str__` method.
You should also be able to describe what test cases you would use to thoroughly
black-box test each of your class methods. (Although you might find that you
want to add additional white-box test cases depending on your implementation).
Before finding a TA or professor, make sure your functions have:
- appropriate docstrings
- good algorithm comments
- mnemonic variable names
- good use of horizontal and vertical white space
We will double check your code, ask you a few questions about it
and the additional methods you plan to implement,
answer any questions you have, and award your points for Part 1.
This must be completed before leaving the lab.
After that you should start working on Part 2.
## Part 2
For the remainder of the assignment you should complete the implementation of
your class and your `main()` function. You should also create a file named
`classes_tester.py` that thoroughly tests all of the methods in your class.
I strongly encourage you to implement the tests as you go rather than implement
the class first and then implement the tester file. Note: As you implement
your class, you might realize that you want to change your design from lab.
That's fine, just make sure that your final submission meets all the
requirements detailed above.
#### Coding Style
Make sure that your program is properly commented:
* You should have comments at the very beginning of the file stating your name, course,
assignment number and the date.
* Each function should have an appropriate docstring, describing:
- the purpose of the function
- the types and meanings of each parameter
- the type and meaning of the return value(s)
* Include other comments as necessary to make your code clear
In addition, make sure that you have used good style. This includes:
* Following naming conventions, e.g. all variables and functions should be
lowercase.
* Using good (mnemonic) variable names.
* Proper use of whitespace, including indenting and use of blank lines to
separate chunks of code that belong together.
For more detailed descriptions, please review the [Python Coding Style Guidelines](python_style.html).
## Part 3: Feedback
Create a file named `feedback.txt` that answers the usual questions:
1. How long did you spend on this assignment?
2. Any comments or feedback? Things you found interesting? Things you found
challenging? Things you found boring?
## Submission
For this lab you are required to submit two files:
- `classes.py` a python file that contains the class that you developed as
well as a main function to demonstrate that class.
- `classes_tester.py` a python file that thoroughly tests all of the methods in
your class.
- `feedback.txt` a text file containing your feedback for this assignment.
These should be submitted using [submit.cs.pomona.edu](http://submit.cs.pomona.edu)
as described in the general [submission instructions](submit.html).
## Grade Point Allocations
| Part | Feature | Value |
|-----------|----------------------------------------------|----|
| Lab | Check-in | 3 |
| | | |
| Implementation | class definition meets all requirements | 8 |
| Implementation | main function meets all requirements | 3 |
| Implementation | class methods execute correctly | 12 |
| Implementation | main function executes correctly | 2 |
| | | |
| Testing | `classes_tester.py` thoroughly tests all methods | 10 |
| | | |
| Style | Docstrings present,accurate, relevant | 4 |
| Style | Comments in code accurate, relevant | 2 |
| Style | Good coding style (e.g., variable names and whitespace) | 2 |
| Style | Good use of loops and conditionals | 2 |
| | | |
| Feedback | Completed feedback file submitted | 2 |