### The George Washington University School of Engineering and Applied Science Department of Electrical Engineering and Computer Science CSci 51 -- Fall 1998 Project #2 Due Date: start of class, Thursday, 17 September 1998

The purpose of this project is to help you begin to use 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:

First compile the Screen and Spider packages:

Now write and test a program that instructs the spider to draw a pattern in the shape of a rhombus, that is,

```

XXXXXXXXX
X       X
X       X
X       X
XXXXXXXXX

```

Hints: Start the spider facing West, draw the top line, etc. Also note that you can get the spider to draw a "blank" by changing its color to black. No case study is needed for Part 1.

#### 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
------------------------------------------------------------------

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

Now develop and test a program that finds the largest, smallest, and average of seven integers read from the terminal. Remember, a case study is necessary for Part 2.

Hint: Declare variables for the sum, current smallest, and current largest values. You do not need to store all six 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.