CS-2301 Programming Assignments

B-Term 2009
CS-2301 Home Page

There will be approximately six programming assignments in CS-2301 — about one per week. In each programming assignment, you will write a program in C to use features of the language introduced in class or in the textbook. A completed programming assignment comprises one or more files with the .c or .h extension plus a written explanation of what you did, the basic algorithm you implemented, and any difficulties that you encountered. Specific assignments may also require you to submit your test data and/or output.

Completion of, or good-faith attempts at, all programming assignments is required to pass this course. If you find that an assignment is too difficult or takes too long, then it is best to submit what you have done on time, along with a written explanation analyzing your difficulty or lack of understanding. (You should also follow up with a TA or the Professor.)

Programming Environment

Most students will carry out their programming assignments on the CCC systems running Linux. These provide the tools necessary to write and debug C programs, including text editors, compilers, debuggers, etc. The lab sessions are designed to help you learn to use these tools. Windows workstations in the public computer labs on campus include the PuTTY program and X-Win server to provide interactive access to the CCC computers.

Some students may prefer to work in their own environments — e.g., their laptop or desktop computers at home or in their dorms, which might be Macs, PCs, or Linux systems. This is acceptable, except that there may be subtle differences in the C language or compiler between these environments and the version implemented on the CCC system. All grading will be done on the CCC systems. Therefore, if you develop a program on another computer, you must verify that it still compiles and works correctly in the CCC environment.

Program editor

You may use any editor you choose for writing and editing your programs. Many computer scientists, especially those who grew up using variations of Unix or Linux, prefer EMACS. However, many non-computer scientists find EMACS counterintuitive, hard to learn, harder to remember, and difficult to use.

As an alternative, the Professor recommends the text editor kwrite. This has a familiar “point and click” interface that is similar to most Windows and Macintosh applications, including the usual File, Edit, View, etc., menus. To invoke kwrite from a command shell on a CCC system, simply execute the following command in a command shell:–

kwrite file_name &

You need to have an “X-Windows” server (such as X-win) running on your computer, so that the CCC system can display the editor window on your desktop. Most computers in the WPI public computer labs have X-win enabled by default. WPI has a campus-wide license for X-win; consult the Helpdesk if you need to install it on your own computer.

To configure kwrite for editing C programs, start kwrite, pull down the Settings menu and select Configure Editor… In the configuration window that appears, select the Indentation icon in the left panel (5th from the top) and set the Indentation mode to C Style (one of the pull-down options). This causes the editor to automatically indent your programs to conform to the usual practice in C, making your program more readable, helping you see matching brackets, parentheses, quotes, etc., and generally making life easier for you as a programmer. (EMACS has similar capabilities.)

Compiling

All submitted programs must compile correctly and without warnings on the CCC system in order to receive any credit for an assignment. If the graders cannot compile a submitted program, they will make a good faith attempt to contact you by e-mail and give you a chance to fix it. If you can fix the problem within 24 hours, the graders have the discretion to re-grade your assignment and deduct a 25% penalty.

Submitting your Work

You must submit your programming assignments using the turnin program installed on the CCC systems; this is explained on the following web page:–

http://www.cs.wpi.edu/Resources/turnin.html

The turnin tool enables you to submit one or more files as part of your assignment, to verify that they have been correctly submitted, to re-submit (i.e., overwrite) files if necessary, and to check your grade for the assignment and to receive feedback from the graders.

Turnin automatically time-stamps your submissions and identifies those that are late. The graders can download your files to a separate directory, compile your program, and test it against their own data or test cases. Finally, they can upload comments and grades that only you can access.

(If for some reason, turnin does not work for you, please contact the Professor or a TA immediately by e-mail and attach a zipped file containing all of the files of your submission.)

Assignments

The following are the programming assignments for CS-2301. All assignments are due at 11:59 PM on their due dates.

Assignment
Name

Due
Date

Title

Assignment
Description

PA1

Nov 4

Circumference and Area of a Triangle

.doc

 

html

PA2

Nov 11

Print a 12-Month Calendar

.doc

.ppt

html

PA3

Nov 18

User-defined functions —
the game of Craps

.doc

.ppt

html

PA4

Nov 24

Arrays and Pointers

.doc

.ppt

html

PA5

Dec 4

Binary Trees

.doc

.ppt

html

PA6

Dec 13

Strings and Dynamic
Memory Allocation

.doc

.ppt

html