CS140 -- General Information

James S. Plank


Grading

The grading break down will probably be something like 50% lab, 25% midterm, 25% final exam. A is 90%. B is 80%. Etc.

Lab Stuff

There are two labs: one on friday, and one on monday. Lab attendance is mandatory.

Labs are due at 11:59:59 PM Tuesday nights. You must perform your labs alone. Obviously, you may talk about your labs with the TA's and with other students, but when it comes time to code, you must write your own code. Otherwise, it is plagiarism.

A corollary of this is to protect your directories so that no one can read them. If you do all of your work in ~/cs140, then right now, do:

UNIX> chmod 0700 ~/cs140
If someone cheats off of you, chances are we cannot determine that, since file access times can be modified. In the past, when I have discovered cheating, both parties (cheater and cheatee) get zeros. Protect yourself.

Lateness Policy

The TA's will come up with a lateness policy.

Commenting Your Code

You will be graded on commenting. Something like 15%. You should comment your code by blocks of comments at the beginning of your files, and before subroutines. Variables should be commented inline. You may also want to comment large blocks of code. You should not comment with a ``running commentary'' to the right of your code, because that is often useless, hard to maintain, and disconcerting. I have seen comments like the following:
  if (i == 0) {               /* If i equals zero */
    return;                   /* then return */
  } else {                    /* otherwise */
    exit(1);                  /* exit with a value of one */
  }
The above is an extreme example, but don't let it happen to you.

Here's an example of what I would consider a well documented program:

 
#include <stdio.h>

/* sumnsquared.c
   Jim Plank
   August 23, 1998

   This program prompts for and reads a value n from standard
   input, and then calculates and prints the sum of squares
   from one to n.  It uses a for loop instead of using the 
   closed form expression.
   */


main()
{
  int n;                   /* The value */
  int sum;                 /* The running sum of squares */
  int i;                   /* An induction variable */

  /* Prompt for and read in a value of n */

  printf("Enter a value n: ");
  fflush(stdout);
  if (scanf("%d", &n) != 1) {
    exit(1);
  }
  
  /* Calculate sum for each value of i from one to n */

  sum = 0;
  for (i = 1; i <= n; i++) sum += (i*i);

  /* Print the final summation */

  printf("%d\n", sum);
}