CST 8110 - Assignment 16 (final)
Last revised: Sunday September 27, 1998 01:06.
This assignment is due in my assignment box by 13:45pm on
Monday, August 11.
This is the last assignment for the course.
All assignments are evaluated based on their neatness and how
closely they follow the assignment
submission guidelines published in the online course notes.
Purpose and Instructions
This assignment demonstrates your ability to understand the
remainder of C language loop constructs. To do this assignment
correctly, you must read and understand Chapter 5.
The CST 8110 Blue Book contains the Algonquin standard for
writing DO/WHILE and FOR statements in C and pseudocode. The
appendices contain many examples of DO/WHILE and FOR statements
used in programs and pseudocode. Use these examples to guide you.
Before you begin this assignment, finish reading Chapter 5.
Review the Self-Check exercises for sections 5.5, 5.6, and 5.7.
You do not have to hand in these exercises; however, you must
know how to do them.
Pay careful attention to sections 5.9 and 5.10 dealing with
debugging programs and common errors.
Assignment:
- Finish reading Chapter 5. This is the last chapter we
cover in this course.
- Review the Self-Check exercises for sections 5.5, 5.6 and
5.7 on your own; bring questions to your Lab if you have
difficulties. You do not need to hand in these exercises;
however, you must know how to do them.
- Write the following programs in Algonquin standard form:
- 5.5: Programming problem #4, page 238 in the
textbook. Remember to echo your input!
- 5.6: Programming problem #2, page 242 in the
textbook.
- 5.7: Programming problem #1, page 246 in the
textbook. Remember to echo your input!
- PP: Programming problem #1b, page 263 in the
textbook. Remember to echo your input!
Read input numbers as integers; the average and
standard deviation should be output as real
numbers with 4 decimal places. "Range"
is the maximum value minus the minimum value.
The order of the output fields must be exactly as
follows:
- the count of values input
- the smallest value
- the largest value
- the average of the values
- the range of the values
- the standard deviation of the values
- Hand in the source code listings of the above programs.
- Hand in one page of output from each program using the
following input values:
- for 5.5: 1 -2 3 -4 5 -6 7 -8 9 0
- for 5.7: 8 1 8 2 8 3 8 4 8 5 8 6 8 7
8 9 8 15 8 23 8 24
- for PP: 1 -2 3 -4 5 -6 7 -8 9 -10 11
-12 13 -14 15 -16 17 -18 19 -20
Notes:
- To calculate a minimum value when reading integer values,
use a constant macro MAXINT to initialize the
"minimum" value to the largest possible integer
and update "minimum" in the loop. Integers are
two bytes, signed, on the PC. (Hint: What is the
hexadecimal value of the bit pattern for the largest
[most positive] two-byte signed integer?)
- To calculate a maximum value when reading integer values,
use a constant macro MININT to initialize the
"maximum" value to the smallest possible
integer and update "maximum" in the loop.
Integers are two bytes, signed, on the PC. (Hint: What is
the hexadecimal value of the bit pattern for the smallest
[most negative] two-byte signed integer?)
- To enter a constant in hexadecimal notation in C, see the
"Numeric - Hexadecimal" syntax on page 30 of
the David Bray Blue Book. Examples: 0x0000,
0xFFFF, 0xBEAD, 0x1234, 0x8000, 0x7FFF
- What is the relationship between the bit pattern for
MAXINT and MININT?
- Follow carefully the Algonquin standard for coding
DO/WHILE and FOR statements and functions. Refer to the
CST 8110 Blue Book.
- See the David Bray Blue Book: pages 7-13 for an excellent
summary of loop construction, stepwise refinement, and
nested loops.
Evaluation
The aggregate of all assignment marks comprises
25% of your final mark. All assignments must be
completed satisfactorily to get credit for the course, even if
the assignments are submitted too late to receive a mark. (See
the course outline.)
Late assignments are handled according to the policy given in
the course outline.