Summer 2006
To receive full credit, each programming assignment must be handed in on the due date no later than the beginning of class on Tuesday.
An acceptable score means that your program compiles, runs, is correct, solves all of the requirements asked for in the assignment and is written using good programming style. An unacceptable score means that one or more of these criteria were not meet.
Each program you turn in must contain an initial block of comments with this information:
1) your name
2) the class
3) the assignment number
4) the compiler you are using
The program should contain sufficient additional comments to clarify what you're doing. A reader of the program should be able to determine from the comments alone a general idea of what is happening without actually having to decipher any code.
Avoid redundant comments which don't add to the reader's comprehension. Good comments explain why you're doing something or what it means in the context of the program.
Here's an example of what I consider to be helpful comments in code searching for the largest value in an array. Also notice how the variable names are chosen to describe the values the names represent.
hiVal = arr[0]; // Assume first element's value is largest
hiSub = 0; // Remember position of largest value
n = 1; // Start searching with the second element
while (n < MAX) // Look at each element
{
if (arr[n] > hiVal) // If this element value is larger than previous largest,
{
hiVal = arr[n]; // save it as largest,
hiSub = n; // and remember its position
}
n++; // Look at the next element
} // end of loop to find the largest element
Modularize your program. The main function should have minimal references to implementation-dependent details. Unless a particular assignment states otherwise, only file variables may be declared globally; all other variables used by a function must be declared locally or passed as parameters. Every program module should have a block of comments explaining what the module does.
When creating a class try to make it general and flexible for maximum reusability. Always provide class access functions to return private variable values so that clients can code their own functions for operations the class implementer didn't anticipate.
Choose reasonably descriptive identifiers to name variables, constants, functions, classes, etc. Single-character identifiers are unacceptable except for variables like subscripts and loop-control variables (and a more descriptive identifier is recommended for these variables whenever it is appropriate).
Please use at least minimal indentation standards such as indenting statements within a loop, aligning the clauses of IF statements, etc. This will not only make me happy but will also make your life easier in reading and debugging your own programs. Following the coding styles used in the Malik book programming examples would be one way of choosing a good coding style. In any case, whatever style you choose be consistent in applying it throughout your code.
Use blank lines liberally to separate sections of your program, and use extra spacing within a statement to enhance readability.
INPUT FILES
If an assignment specifies an input file, that file will typically be provided for you and be available on my web page. It doesn't matter where you put the file when you test your program; I will expect to change your filename path.
HAND IN
We will be using the eCollege online system to hand in and hand back programming assignments, as well as other information. For each assignment, upload a machine-readable copy of all source files needed to run your program. Since I will compile and run each program myself, it is not necessary to give me other files, like workspace or executable files. Please make sure that your name appears in comments in every file of your program.
PLAGIARIZING
Programs which are so similar that they are almost certainly copies of one another will receive a grade of unacceptable. Unfortunately this penalizes the original author as well as those who cheat. To protect yourself from this penalty, protect your own work. Don't leave copies of your program on the hard disk of a lab PC and don't leave diskettes or hard copies of your program lying around. Definitely do not give anyone else a copy of your program.
Tips for successful programming:
1) Spend some time on the design of your algorithm and consider possible alternatives before you do any
coding.
2) Design your program in modules, no matter how you actually code it.
3) Code and test one module at a time.
4) Always echo your input to the screen to make sure your data is being read properly.
5) Don't wait until the last minute to start working on a programming assignment.