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.
-
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.
-
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
*/
-
All assignments must #include at
least these standard libraries header files:
- 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.
- 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
...
}
-
Use descriptive function and variable
names. Use "camelCasing" for readability. For example,
qtyPurchased,
taxRate,
firstName
are preferred to q,
txr, and
fn.
-
Your program must meet these coding
standards:
-
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".
-
Neither statements nor comments
should extend past column 80.
-
Leave whitespace (skip a line):
- Between variable declarations and statements in a
function
- Between function definitions
-
Wherever else it adds to the
clarity of the code by separating it into logical sections
- 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
}
- 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.
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 .
Follow these steps to reduce the time you spend coding and
debugging your programs.
-
Read the assignment carefully to
understand exactly what is required.
-
Create an overall design listing the
major functions that need to be accomplished, then break down
each of these into specific functions.
-
Code, compile, and test program
functions incrementally; "stub" functions that will be written
later.
-
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.
-
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.
-
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.
-
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.
-
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 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.
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.
|