(This assignment is adapted from one that appears in A
Computer Science Tapestry by Owen Astrachan)
(
Latest Revision:
10/24/2012
)
FOURTH CS 1500 SOLO PROGRAM
Stack of Jack O'Lanterns 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 "jack o'lanterns" in a stack.
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 6, 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 jack
o'lantern N times. After drawing the jack o'lanterns, it must draw a little
"base" so that it looks like the jack o' lanterns are standing on something.
EXAMPLE OUTPUT:
Examine the
sample script
to get an idea of how it should look when you run the program.
(Caution: The sample script is not meant to illustrate thorough
testing of the program.)
DESIGN:
I have prepared a shell
program that you should use as a starting point for your solution to this
programming problem.
The shell has three functions to fill in, including the main() function.
You can create a program with a good design if you follow the directions found
inside the shell.
Be sure to attend class to get additional information that will help you
with this assignment.
TESTING:
I expect you to make a test script for the program that shows good data
coverage. I will discuss that concept in class. The basic idea is:
- to test a representative sample of inputs, and
- to test at and near data boundary values.
It is your responsibility to devise and carry out adequate tests. You must do
something more than just copy the tests I performed in my little sample
script. You will lose significant credit if you do
not perform adequate testing. However, I will give you
information to help you figure out what tests you need to do.
WHAT TO TURN IN:
You will be sending me two e-mail messages. Please follow these
rules:
- Always send me e-mail as plain text in the main message body.
Never send me attachments.
- Always use the exact subject line I specify for each
message. (I often get hundreds of e-mail messages in a week. The
subject line allows me to find and sort messages.) You will lose a
significant number of points on the assignment if you use the wrong
subject line.
- Be very careful when you send the e-mail. You may use the
instructions in your
Hello World! lab excercise
for guidance. Of course, you will need to make the obvious changes to
those directions -- you have to use the correct subject line and
filename.
- Always send yourself a copy of each e-mail message you send to me,
check immediately to see if you receive the message intact, and
check within a few minutes to see if you have received e-mail notifiying
you about an undeliverable message. You are
responsible for sending e-mail correctly.
Here is the list of things that you have to turn in:
- At the start of class on the
due date
place the following item on the "counter" in front of me:
- a hardcopy (printed listing) of your program (the C++ source code).
Make sure all the code is properly formatted and that it all shows
on the paper. (You can't put more than about 75 characters on any
line, and don't put any tab characters in your program.)
- Before midnight on the due date
send me the following by e-mail:
- A copy of the source code (C++ code) with subject line:
CS1500Solo4Source
and
- a (filtered) script, with subject line
CS1500Solo4Script
showing the results of several runs of the program illustrating:
- output on all appropriate boundary values,
- output on a representative sample of inputs that are "out of
bounds," and
- output on a representative sample of inputs that are well
within bounds.
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.)