Grading Criteria for Programs
CpSc146
This document describes the criteria used for grading your programming assignments. The list is not meant to be a cook-book of how to get a program working, but instead detail what is used for grading purposes.
Each programming assignment you turn in must include both the program and the output from the program; a program turned in without any output will receive a maximum of 50% of the points possible. A program that works correctly is an average program and thus earns a grade of 75%. A correct program works for "all" data (not simply the test data that is used for the final run) and the program must meet the criteria for the particular assignment. The following is a description of what is expected of your programs for the additional 25%.
- Following directions
- The program must follow the directions as stated in the programming assignment.
- The program must terminate normally for all possible inputs, not just the data for the final run
- Documentation
- Documentation at the top of the program must include:
- Programmer's name
- Programmer's section number
- Complete program description
- No grammatical or spelling errors
- Variable dictionary for the main program and any global constants
- Documentation within the program must be provided to explain complex code segments
- Identifiers
- Use meaningful variable names (reflect the variable's purpose)
- Use all caps for constants
- If multiple words are used, separate them with the underscore
- Indentation
- Use at least two spaces for indentation
- All statements in a given level of indentation must be indented the same number of spaces
- Each level of indentation is additive; for example, notice how criteria 2.a.i. is indented.
- White Space
- Use blank line(s) to separate sections of code; for example, you may place a blank line between the input statements and the processing statements.
- Use spaces or tabs prior to a comment on a line
- Declaration of Variables and Constants
- Declare all variables at the beginning of the function or main program
- Do not declare a variable within a control structure (e.g., the for statement)
- Declare constants globally only if necessary.
- Variables of type char should not be used to hold integers.
- Avoid unsigned types
- Use int for whole numbers (long int when necessary)
- Use double for real numbers (float or long double when necessary)
- Input and Output statements
- Precede input statements that request user input by an output statement that thoroughly explains what the program is expecting.
- No grammatical or spelling errors in output statements
- Do not repeat formatting manipulators unless necessary
- Other statements
- Explicitly type cast a variable in assignment statements when necessary
- At most one C++ instruction per line of code
- Control Statements
- When a particular type of statement (e.g., loop, selection) is needed, select the most appropriate control structure for the task.
- Indent statements within a control structure.
- Functions
- Each function created should do one task; if more than one task is needed, create another function.
- Each function must begin with a description of the function followed by a variable dictionary for that function. The variable dictionary includes all local variables and the parameters.
- Parameters must be passed by value unless the function returns more than one result.
- Use void as the return value (even for main) unless a value is being returned.