Coding Style and Capitalization Conventions

Please include Precondition:/Postcondition: commenting at the beginning of every function in your program. State all assumptions on input arguments explicitly. State any changes that the function can make to any nonlocal variable explicitly. The importance of this practice cannot be overemphasized. The modularity and correctness of your program depend on its ability to follow these "contracts" that you define for each module. Therefore, the contracts must be exact.

Nested blocks of code should be indented 2 or 3 spaces to the right of their enclosing blocks.

The closing brace for a block must be aligned vertically either with its matching opening brace or with the first nonspace character of the line in which that opening brace appears. For example,

     for (int i=1; i < M; ++ i)
     {
	// ....
     }
and
     for (int i=1; i < M; ++ i){
	// ....
     }
are both common and acceptable.

Please use the following capitalization conventions. Glaring inconsistencies may be penalized.

  1. Programmer-defined class names should be capitalized. The name may or may not end in the word "Class". E.g.,
       	class DateClass{ .... }
       
    and
       	class Date{ .... } 
       
    are both acceptable, though most people prefer the latter.
  2. Names of class variables (object names) may be capitalized but usually are not.
     Date today;
       
    is preferred over
     Date Today;
       
    Certain large objects (e.g., a table or a 2-D array) might be given capitalized names to emphasize their large sizes.
  3. Function names are not capitalized.
  4. Named constants have every letter capitalized:
       	const int MAX_SIZE = 100;
       
  5. Camel notation (first letter of each word capitalized, no underscores) is used to run words together in variable names:
       		int theBigOne = 7;
       
    But underscores are used to separate words in named constants, as in the preceding example.
  6. Type names created with typedef or enum are also capitalized. They may or may not end in the word "Type".