(This assignment is adapted from one that appears in A Computer Science
Tapestry by Owen Astrachan)
(Latest Revision: 04/13/2001)
FOURTH CS 1500 SOLO PROGRAM
Totem Pole Assignment: Writing A Simple Loop
OBJECTIVE:
The purpose of this programming assignment is to get you started 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:
Before midnight on the due date, e-mail the following two items to
me:
- A copy of the source code, properly documented.
- A filtered script showing appropriate testing.
My e-mail address is:
john@ishi.csustan.edu
Please
use the following subject lines exactly for the e-mails:
For the source file: CS1500Solo4Source
and for the script file: CS1500Solo4Script
Note that there are no spaces in these subject lines. If you like, you can
copy and paste the subject lines right from this document.
Thanks!
Your use of these subject lines will really be a big help to me when I try
to sort through the perhaps hundred e-mail messages that will be in my
electronic mailbox!
WHEN IS THIS ASSIGNMENT DUE?
Look for the due date in
the class schedule.
(It's at the top level of the class directory.)