Any submitted code should be fully understood by all parties. Failure to do so will, again, be interpreted very negatively.
Example,
/*------------------------------------------------------------------
Casey Jones
September 8, 2044
Homework #1: Problem 1 - p.45 (1.2.14)
Command line arguments are two integers.
Program makes sure both are positive and prints
an informative result about whether or not either
evenly divides the other.
Collaboration: Hunter Smith helped me out on checking for positive numbers.
Showed me how to correctly use variable & convert from args[0].
I helped Pat Guntz & Mars Zu with division versus modulus.
They were confused about about how to call from Math.
------------------------------------------------------------------ */
//get count of stars from command line No space between // & g in get
int cnt = Integer.parseInt( args[0] );
For example, the below is an excellent example of documentation. One line of documentation explains several statements. And does it well!
// read three dimensional coordinates from command line
double x = Double.parseDouble(args[0]);
double y = Double.parseDouble(args[1]);
double z = Double.parseDouble(args[2]);
Pay attention to what you are doing. It is possible that some sections of your source code are 'self-documenting'. This is likely when you have been thoughtful about your variable names. See below.
Example - bad because it describes syntax of code:
int x; // declare variables
int y;
Example - bad because it repeats code & adds no extra meaning:
int r1; // three integers
int P,t;
So what's a good comment for this set of variables?!?
In this example all variables are so well named, they do not need additional documentation.
The code is self-documenting.
double interestRate;
double amtPrincipal;
int numYears;
validDayInSept = 1<=day && day<=30;
is much better than the following equivalent but awkward code.
|
if ( 1<=day && day<=30 )
validDayInSept = true;
else
validDayInSept = false;
|
if ( validDayInSept )
System.out.printf("\n Great Day in Sept" );
is much better than the following equivalent but awkward code.
|
if ( validDayInSept == true )
System.out.printf("\n Great Day in Sept" );
|
while ( !done ) {
. . .
}
is much better than the following equivalent but awkward code.
|
while ( done == false ) {
. . .
}
|
// Make inner circles as long as radius is big enough
while (r > 20){
. . .
}
is much better than the following equivalent but awkward code.
|
// while loop for circles
while (r > 20){
. . .
}
|
while (radius > MINIMUM_RADIUS){
. . .
}
is much better than the following equivalent but awkward code.
|
while (r > 20){
. . .
}
|
Unless assigment specifies otherwise, you must prompt user for input.
Unless assigment specifies otherwise, you must perform error checking.