Homework Guidelines

C Programming (COP 2220) and OOP with C++ (COP 2334)

This page provides guidelines for preparing your homework, the criteria that will be used to grade it, and how to get help if you have trouble with the assignment.


Homework preparation

  1. Develop your program using the Dev-C++ IDE. (You can use any ANSI C/C++ compiler, but I will compile and run your program with Dev-C++.) The source code should be saved with the filename specified in the assignment and the proper extension: .c for C programs, and .cpp for C++ programs.

  2. The first two lines of your program must be comments, including the source file name, assignment number, author's name (or names if a team assignment), date written, and a short description of the program. For example:

    /* quad-bbt.c -- Billy Bob Thornton -- 2007-01-12
          Solves general quadratic equations
    */
  3. All assignments must #include at least these standard libraries header files:

    • in C: <stdio.h>
    • in C++: <iostream> and <cstdlib>

  4. The main function of all assignments must conform to this syntax:
    int main()
    {
       declarations
       
       statements
       
       system("pause");
       return 0;
    }

    The system("pause") statement is to keep the console window open when running the program from the Dev-C++ IDE.

  5. Variables must be declared at the beginning of the block in which they are used with a comment describing its use in the program. (Loop control variables can be declared within a for statement without comment in C++ programs.) For example:
    int main()
    {
       int    age;         // age in years
       double weight;      // weight in kilos
       char   fstat[15];   // profile description
       ...
    }
  6. Use descriptive function and variable names. Use "camelCasing" for readability. For example, qtyPurchased, taxRate, firstName are preferred to q, txr, and fn.

  7. Your program must meet these coding standards:

    1. Indentation must be consistent, including at least statements within a block (braces). Set editor tab stops to 3, and enable option to "Replace tabs with spaces on file save".

    2. Neither statements nor comments should extend past column 80.

    3. Leave whitespace (skip a line):

      1. Between variable declarations and statements in a function
      2. Between function definitions
      3. Wherever else it adds to the clarity of the code by separating it into logical sections

    4. Braces ( { and } ) defining a block (of a function body, or compound statements following a control-flow keyword) should be aligned vertically or in the K&R style – but be consistent! For example:

          if (x > 0)       /* vertical alignment style */
          {
             statements
          }

           - or -

          if (x > 0) {     /* K&R style */
             statements
          } 

       
    5. Your program should  include comments adequate to describe the purpose of all functions and variables and any non-obvious logic, but don't obscure your code with unnecessary comments.

Grading criteria

Your programs should produce the correct output for the range of input specified. Each homework assignment is graded on a scale 0-5 based on the following criteria. Note that your program must compile to receive a minimum grade of 3.

Grade Program Characteristics
90-
100
All specifications met; the source code is efficient (uses the best algorithms and functions for the task) and maintainable (is easy to follow and well-documented with descriptive variable and function names, comments).
80-89 All major specifications met, but source code is inefficient (poor logic or inappropriate functions used) and/or difficult to maintain (hard to follow or lacking in documentation)
70-79 Compiles, but some major specifications are not met (function not provided or incorrect output)
60-69 Does not compile, but reasonable attempt made.
< 60 Does not compile, little evidence of effort
0 Not turned in, or an assignment similar beyond coincidence to another student's (who also gets a 0, regardless of who really did the work)

Additionally, a point may be deducted from the above grade for gross non-compliance with the homework preparation requirements listed above. Review your work before submitting it to ensure it complies with these standards. Your grade and my comments will be included in the source code file, which will be returned to you by email .


Homework assistance

Follow these steps to reduce the time you spend coding and debugging your programs.

  1. Read the assignment carefully to understand exactly what is required.

  2. Create an overall design listing the major functions that need to be accomplished, then break down each of these into specific functions.

  3. Code, compile, and test program functions incrementally; "stub" functions that will be written later.

  4. Correct syntax errors by analyzing the error messages provided, comparing your code with program examples from the text. The most frequently made coding mistakes are discussed in Common C/C++ Coding Problems.

  5. When you have a clean compile, rigorously test your program to make sure it produces the correct output for the range of input specified in the assignment.

  6. To correct logic errors, insert statements to display the value of variables at key points in your program, or use the IDE's interactive debugger to step through your program and monitor variable values.

  7. If you can't identify the reason for an error by following the above steps, ask your partner (if a team assignment), a classmate, or any other knowledgeable programmer to look at your code. However, keep our policies on academic integrity in mind:  your final product must represent your own work.

  8. Ask me for help during office hours. You can also email me for assistance. Be sure to include your source code as an attachment, send your email to sdifranc@fccj.edu, and include the word "Help" in the subject line.


Homework Submission

Homework is due by midnight of the date specified in the class schedule. Send your homework as an email attachment from your College email account to sdifranc@fscj.edu.  Include your name, homework number, and the class and reference number in the subject line. Example:

Sean Connery HW03 COP2220 Ref #249086

Note: If you are asking for help on an assignment, rather than turning it in, make sure to include the word "Help" in the subject line.


Team assignments

For some homework assignments, you will be randomly teamed with another student. Only one program is submitted, and both team members get the same grade. If more than one program is submitted, I will randomly choose one to grade. You can divide the work any way you can agree on. Some common possibilities:

  • Each team member writes the program individually, then collectively compare them and submit the better one
  • One team member writes the program, the other independently tests it
  • The team decomposes the program into functions, which are assigned to individual team members to write and test, then integrated
  • One team member does all the work, the other provides the food, moral support, or some other "team-building" asset

However you divide the work, make sure you have each other's email address. Don't rely on seeing your team member in class to resolve problems. One team member should submit the assignment, sending a copy ("cc") to the other team member. Both team member's names should be included in the first line of the source code, and the email subject line. 

 Updated: 01.22.2010