Common Reasons for Losing Points on Assignments
- Failure to include a variable dictionary, which consists of inline comments to the right of the variable declarations. The comments should explain the purpose of each variable even if the name of the variable is self-documenting. Do not use an inline comment such as "// declaring lengthOfFrame as an integer variable" but rather something like "// total vertical length of frame". Do not declare multiple variables on one line of code even though this is possible in C++. That is,
Declare variables like this.... / Not like this....
int lengthFrame = 0;
area = 0.0; / // total vertical length of frame
// total area of frame / int lengthOfFrame, widthOfFrame; / // user inputs
- Failure to include the proper header at the beginning of the program. Follow the specified model EXACTLY.
- Failure to use the correct method for naming variables. Variables should be whole words or concatenated phrases that describe the values they represent. I specify that identifiers begin with a lowercase letter but have consecutive words that begin with capital letters without using underscores (eg. numStudents, homePhoneNumber). However, constants must be named with uppercase letters and underscores.
- Failure to document the end of the main function or any other user-defined function by providing an inline comment after its closing brace.
Document the end of your main function like this...
....
return 0;
} // end of main
- Failure to include blank spaces around operators such as *, -, >, <, etc.
- Failure to use int main ( ) at the beginning of the main function rather than main ( ) .
- Failure to keep the user's input on the same console line as the corresponding input prompt. Also, I prefer that you use colons to between the prompt and the user's inputted value.
Obtain input like this.... / Not like this....
cout < "Please type the width in whole inches: ";
cin > widthOfFrame; / cout < "Please type the width in whole inches." < endl;
cin > widthOfFrame;
- Failure to use suitable input prompts so that the user knows what data to enter and how to format the data. If the user is expected to type whole numbers, for example, you should prompt him or her to do exactly that.
- Failure to close an external file when you are finished using it.
- Failure to indent statements that wrap around to a second line of code. You should take the time to make sure that your code is neat, presentable, and easy to read before you submit an assignment. See the instructor if you have difficulty printing programs with the Visual C++ compiler.
- Failure to have ALL variable declarations at the top of the main function.
- Stapling printouts stapled in the wrong order
- Incorrectly naming the source file that was submitted. Do not include blank spaces or the # symbol in the name of a source file.
- Mislabeling the floppy disk submitted.
- Failure to use constants instead of variables where appropriate. For example, MI sales tax should be a constant rather than a variable.
- Failure to provide inline comments to detail the more complicated parts of an algorithm
- Failure to include one blank line above and one blank line below each structure including if, switch, do, while, for
- Failure to initialize variables that need to be initialized within their declaration statements. Usually int variables should be initialized to 0 and double variables should be initialized to 0.0. Do not declare a variable and then use an assignment statement to set it to a certain value if you can initialize it in an initialization statement.
do initialize variables in their declaration statements like this.... / do not do this....
int lengthOfFrame = 0; / int lengthOfFrame;
lengthOfFrame = 0;
Common reasons for loss of points on pseudocode:
- Failure to place the prompt for a user input (usually a cout statement) on a separate line of pseudocode than the actual act of obtaining the input (usually a cin statement)
- Misspelling -- you can easily use a spell checker with your pseudocode.
- Failure to break down large steps into small ones to show the thought process that you used to help develop an algorithm.
- Failure to staple the source file, pseudocode, and test plan in the correct order.
Common reasons for loss of points on a test plan:
- Use 0 as a special test value for inputs even if it is not a boundary value
- Failure to include a "Reasons" column which explains why each test plan item was included in the test plan (upper boundary, lower boundary, special value, reasonable, etc.)
- Failure to number your test case items.
- Misspelling. You can easily use a spell checker with Excel spreadsheets.