The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science
CSci 51 -- Spring 1997
Project #3
Due Date: start of class, Feb. 10, 1997

The purpose of this project is to give you some more experience with standard and class-specific packages. Everything you need is in Chapters 1-3; you need not, and should not, use any "extra" statements or anything from later chapters. Part 1 is just a "spider program" for which you need only to turn in a listing file. No Case Study is needed. Part 2 is a word problem requiring a Case Study.


Part 1:

Write a Spider program that requests the spider to draw two of your initials on the screen. For example,

X     X  XXXXX
XX   XX  X
XXX XXX  XXX
X  X  X  X
X     X  X

or

XXXXX      X
X          X
XXX        X
X      X   X
XXXXX  XXXXX

 


 

 

 

Part 2:

Here is the specification for a Min_Max package (we'll look at the body in Chapter 4):

PACKAGE Min_Max IS
------------------------------------------------------------------
--| specifications of functions provided by Min_Max package
--| Author: Michael B. Feldman, The George Washington University 
--| Last Modified: July 1995                                     
------------------------------------------------------------------
 
  FUNCTION Minimum (Value1, Value2: Integer) RETURN Integer;
  -- Pre:  Value1 and Value2 have been assigned values
  -- Post: Returns the smaller of the two input values
 
  FUNCTION Maximum (Value1, Value2: Integer) RETURN Integer;
  -- Pre:  Value1 and Value2 have been assigned values
  -- Post: Returns the larger of the two input values
 
END Min_Max;

First compile the Min_Max package:

gcompile min_max.ads
gcompile min_max.adb

Now develop and test a program that finds the largest, smallest, and average of five integers read from the terminal.

Hint: Declare variables for the sum, current smallest, and current largest values. You do not need to store all five values; read them in one at a time, using the Minimum and Maximum functions from Min_Max to compare each new value to the current smallest and largest.