This website is preserved for historical and scholarly reference and is no longer actively maintained.
Style Standards
CP SC 210
Initial Comments must include
- your name
- CPSC 210 and the section number of your class
- "Homework" and the date (either date due or date completed)
- A statement of the problem.
A comment must appear immediately before each method giving an English prose statement of the purpose of the method (see page 99 for example).
Indention style demonstrated in the text must be used. Examples of this indention style include, but are not limited to the following:
- The reserved word "public" beginning each constructor and method shall be indented exactly three spaces to the right of the beginning of the reserved word "class."
- Instance variables shall be declared private and shall be aligned exactly three spaces to the right of the beginning of the reserved word "class", as above.
- The closing "}" for a class, constructor, or method must be exactly under the "c" of class (for classes) or "p" of public (for constructors and methods).
Other style standards include
- Use meaningful variable names.
- When coding a test for equality, if either of the values to be tested is a constant it must appear on the left side of the test, as in
- if ( 2 == axles ) tollDue = 4;