(This assignment is adapted from one that appears in A Computer Science Tapestry by Owen Astrachan)

( Latest Revision: 11/03/2004 )

FOURTH CS 1500 SOLO PROGRAM
Totem Pole Assignment: Writing A Simple Loop


OBJECTIVE:

The purpose of this programming assignment is to give you practice writing and using loops in your programs.


THE ASSIGNMENT:

Basically, your assignment is to write a program that gets an integer N from the user and then draws N "heads" in a stack that looks like a totem pole.


INPUT, OUTPUT, AND PROCESSING:

The program must begin by writing some information explaining the purpose of the program and a general description of how to use the program.

The program must then prompt for and read the number N.

After getting N, the program must do some error-checking. If N is not between 1 and 10, inclusive, then the program must output an appropriate error message and stop. If N is within the legal range, then the program must draw the head N times. After drawing the heads, it must draw a little "base" so that it looks like the heads are standing on something.


EXAMPLE OUTPUT:

Examine the sample script to get an idea of how it should look when you run the program.


DESIGN:

As before (and always) I expect you to employ good principles of top-down design. I will take off a lot of points if you do not create a program that uses functions appropriately. I suggest that you employ a function to write the directions, a function that draws the head, and a function that draws the base. Your program must have at least four functions, including the main function. Don't forget that each function is required to have a header comment that explains the purpose of the function.


TESTING:

I expect you to make a test script for the program that shows good data coverage. I discussed this concept in class. The idea is to test a representative sample of inputs, and to test at and near boundary data values. It is your responsibility to devise and carry out good tests. It is certainly not enough if you just duplicate the tests done in my sample script. I will take off a lot of points if you do not perform adequate testing.


WHAT TO TURN IN:

You will be sending me two e-mail messages. Please follow these rules: Here is the list of things you have to turn in: Note that there are no spaces in the subject lines given. It is important that you do not insert any spaces. My e-mail address is:

john@ishi.csustan.edu



WHEN IS THIS ASSIGNMENT DUE?

Look for the due date in the class schedule. (It's at the top level of the class directory.)